Skip to content

Commit

Permalink
Add support for hash with brackets style (#38)
Browse files Browse the repository at this point in the history
Fixes #37
  • Loading branch information
ValentinTrinque authored Nov 12, 2016
1 parent 6255a21 commit 26f277d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/arg.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
Arg.__decode = function(s) {
while (s && s.indexOf("+")>-1) {
s = s.replace("+", " ");
};
}
s = decodeURIComponent(s);
return s;
};
Expand Down Expand Up @@ -118,7 +118,7 @@
obj[currentRoot] = obj[currentRoot] || [];
nextSelector = nextSelector.replace(']', '');

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

Expand Down Expand Up @@ -286,7 +286,7 @@
if (s.indexOf("=")===-1 && s.indexOf("&")===-1)
return "";

while (s.indexOf(Arg.hashSeperator) == 0 || s.indexOf(Arg.querySeperator) == 0)
while (s.indexOf(Arg.hashSeperator) === 0 || s.indexOf(Arg.querySeperator) === 0)
s = s.substr(1);

return s;
Expand Down

0 comments on commit 26f277d

Please sign in to comment.