We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1544f13 commit c9d079fCopy full SHA for c9d079f
1 file changed
lib/parse.js
@@ -30,13 +30,14 @@ function parse(input) {
30
let equalityIndex = -1;
31
let shouldDecode = false;
32
let hasPlus = false;
33
+ const lastIndex = input.length;
34
35
// Have a boundary of input.length + 1 to access last pair inside the loop.
- for (let i = 0; i < input.length + 1; i++) {
36
- let c = input.charCodeAt(i);
+ for (let i = 0; i < lastIndex + 1; i++) {
37
+ let c = (i !== lastIndex && input.charCodeAt(i)) || 0;
38
39
// Handle '&' and end of line to pass the current values to result
- if (c === 38 || isNaN(c)) {
40
+ if (c === 38 || c === 0) {
41
// Check if the current range consist of a single key
42
if (equalityIndex <= startingIndex) {
43
key = input.slice(startingIndex + 1, i);
0 commit comments