From eb9fbe4cdf624861a745e3016d72e9c690e55dc1 Mon Sep 17 00:00:00 2001 From: Eli Doran Date: Sat, 17 Dec 2016 06:42:09 -0500 Subject: [PATCH] remove unnecessary escapes (according to npm test results) --- lib/parse.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/parse.js b/lib/parse.js index 97387a6a..fcf0355a 100755 --- a/lib/parse.js +++ b/lib/parse.js @@ -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 @@ -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; }