Skip to content

Commit

Permalink
remove unnecessary escapes (according to npm test results)
Browse files Browse the repository at this point in the history
  • Loading branch information
elidoran committed Dec 17, 2016
1 parent 8aa9c26 commit eb9fbe4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/parse.js
Expand Up @@ -80,12 +80,12 @@ var parseKeys = function parseKeys(givenKey, val, options) {
}

// Transform dot notation to bracket notation
var key = options.allowDots ? givenKey.replace(/\.([^\.\[]+)/g, '[$1]') : givenKey;
var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;

// The regex chunks

var parent = /^([^\[\]]*)/;
var child = /(\[[^\[\]]*\])/g;
var parent = /^([^[\]]*)/;
var child = /(\[[^[\]]*])/g;

// Get the parent

Expand All @@ -111,7 +111,7 @@ var parseKeys = function parseKeys(givenKey, val, options) {
var i = 0;
while ((segment = child.exec(key)) !== null && i < options.depth) {
i += 1;
if (!options.plainObjects && has.call(Object.prototype, segment[1].replace(/\[|\]/g, ''))) {
if (!options.plainObjects && has.call(Object.prototype, segment[1].replace(/\[|]/g, ''))) {
if (!options.allowPrototypes) {
continue;
}
Expand Down

0 comments on commit eb9fbe4

Please sign in to comment.