Skip to content

Commit 26f277d

Browse files
Add support for hash with brackets style (#38)
Fixes #37
1 parent 6255a21 commit 26f277d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/arg.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
Arg.__decode = function(s) {
6767
while (s && s.indexOf("+")>-1) {
6868
s = s.replace("+", " ");
69-
};
69+
}
7070
s = decodeURIComponent(s);
7171
return s;
7272
};
@@ -118,7 +118,7 @@
118118
obj[currentRoot] = obj[currentRoot] || [];
119119
nextSelector = nextSelector.replace(']', '');
120120

121-
if (nextSelector.search(/[\.\[]/) === -1) {
121+
if (nextSelector.search(/[\.\[]/) === -1 && nextSelector.search(/^[0-9]+$/) > -1) {
122122
nextSelector = parseInt(nextSelector, 10);
123123
}
124124

@@ -286,7 +286,7 @@
286286
if (s.indexOf("=")===-1 && s.indexOf("&")===-1)
287287
return "";
288288

289-
while (s.indexOf(Arg.hashSeperator) == 0 || s.indexOf(Arg.querySeperator) == 0)
289+
while (s.indexOf(Arg.hashSeperator) === 0 || s.indexOf(Arg.querySeperator) === 0)
290290
s = s.substr(1);
291291

292292
return s;

0 commit comments

Comments
 (0)