Skip to content

Commit

Permalink
Fix non ES5 compliant regexp (allows use in Duktape; see svaarala/duk…
Browse files Browse the repository at this point in the history
  • Loading branch information
JulesAU committed Feb 14, 2017
1 parent 6370e96 commit d7c6b39
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ function parserForArrayFormat(opts) {
switch (opts.arrayFormat) {
case 'index':
return function (key, value, accumulator) {
result = /\[(\d*)]$/.exec(key);
result = /\[(\d*)\]$/.exec(key);

key = key.replace(/\[\d*]$/, '');
key = key.replace(/\[\d*\]$/, '');

if (!result) {
accumulator[key] = value;
Expand All @@ -64,9 +64,9 @@ function parserForArrayFormat(opts) {

case 'bracket':
return function (key, value, accumulator) {
result = /(\[])$/.exec(key);
result = /(\[\])$/.exec(key);

key = key.replace(/\[]$/, '');
key = key.replace(/\[\]$/, '');

if (!result || accumulator[key] === undefined) {
accumulator[key] = value;
Expand Down

0 comments on commit d7c6b39

Please sign in to comment.