object-scan
Advanced tools
Comparing version 14.4.1 to 14.4.2
@@ -158,33 +158,17 @@ "use strict"; | ||
if (ctx.useArraySelector === false && Array.isArray(haystack)) { | ||
if (ctx.breakFn === undefined || ctx.breakFn(kwargs) !== true) { | ||
if (ctx.reverse) { | ||
for (let idx = 0, len = haystack.length; idx < len; idx += 1) { | ||
stack.push(false, searches, idx, depth + 1); | ||
} | ||
} else { | ||
let idx = haystack.length; // eslint-disable-next-line no-plusplus | ||
while (idx--) { | ||
stack.push(false, searches, idx, depth + 1); | ||
} | ||
} | ||
} // eslint-disable-next-line no-continue | ||
continue; | ||
} | ||
const autoTraverseArray = ctx.useArraySelector === false && Array.isArray(haystack); | ||
const searchesIn = searches; | ||
if (compiler.isLastLeafMatch(searches)) { | ||
stack.push(true, searches, segment, depth); | ||
isMatch = true; | ||
} | ||
if (!autoTraverseArray) { | ||
if (compiler.isLastLeafMatch(searches)) { | ||
stack.push(true, searches, segment, depth); | ||
isMatch = true; | ||
} | ||
if ('' in searches[0] && path.every(p => Number.isInteger(p))) { | ||
assert(searches.length === 1); | ||
stack.push(true, [searches[0]['']], segment, depth); | ||
isMatch = true; | ||
searches = [searches[0]['']]; | ||
if ('' in searches[0] && path.every(p => Number.isInteger(p))) { | ||
assert(searches.length === 1); | ||
stack.push(true, [searches[0]['']], segment, depth); | ||
isMatch = true; | ||
searches = [searches[0]['']]; | ||
} | ||
} | ||
@@ -208,17 +192,21 @@ | ||
for (let sIdx = 0, sLen = searchesIn.length; sIdx !== sLen; sIdx += 1) { | ||
const search = searchesIn[sIdx]; | ||
if (autoTraverseArray) { | ||
searchesOut.push(...searchesIn); | ||
} else { | ||
for (let sIdx = 0, sLen = searchesIn.length; sIdx !== sLen; sIdx += 1) { | ||
const search = searchesIn[sIdx]; | ||
if (compiler.getWildcard(search).anyMatch(key)) { | ||
searchesOut.push(search); | ||
} | ||
if (compiler.getWildcard(search).anyMatch(key)) { | ||
searchesOut.push(search); | ||
} | ||
const values = compiler.getValues(search); | ||
let eIdx = values.length; // eslint-disable-next-line no-plusplus | ||
const values = compiler.getValues(search); | ||
let eIdx = values.length; // eslint-disable-next-line no-plusplus | ||
while (eIdx--) { | ||
const value = values[eIdx]; | ||
while (eIdx--) { | ||
const value = values[eIdx]; | ||
if (compiler.getWildcard(value).typeMatch(key, isArray)) { | ||
searchesOut.push(value); | ||
if (compiler.getWildcard(value).typeMatch(key, isArray)) { | ||
searchesOut.push(value); | ||
} | ||
} | ||
@@ -225,0 +213,0 @@ } |
{ | ||
"name": "object-scan", | ||
"version": "14.4.1", | ||
"version": "14.4.2", | ||
"description": "Traverse object hierarchies using matching and callbacks.", | ||
@@ -61,3 +61,3 @@ "main": "lib/index.js", | ||
"diff2html": "3.4.3", | ||
"eslint": "7.25.0", | ||
"eslint": "7.26.0", | ||
"eslint-config-airbnb-base": "14.2.1", | ||
@@ -75,3 +75,3 @@ "eslint-plugin-import": "2.22.1", | ||
"nyc": "15.1.0", | ||
"object-scan": "14.3.2", | ||
"object-scan": "14.4.1", | ||
"semantic-release": "17.4.2", | ||
@@ -78,0 +78,0 @@ "smart-fs": "2.0.2", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59567
841