Skip to content

Commit 19c3f52

Browse files
authored
refactor: use -1 instead of 0 as lastIndex indicator (#7)
1 parent adfcd15 commit 19c3f52

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/parse.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ function parse(input) {
3434

3535
// Have a boundary of input.length + 1 to access last pair inside the loop.
3636
for (let i = 0; i < lastIndex + 1; i++) {
37-
let c = (i !== lastIndex && input.charCodeAt(i)) || 0;
37+
let c = (i !== lastIndex && input.charCodeAt(i)) || -1;
3838

3939
// Handle '&' and end of line to pass the current values to result
40-
if (c === 38 || c === 0) {
40+
if (c === 38 || c === -1) {
4141
// Check if the current range consist of a single key
4242
if (equalityIndex <= startingIndex) {
4343
key = input.slice(startingIndex + 1, i);

0 commit comments

Comments
 (0)