Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

object-scan

Package Overview
Dependencies
Maintainers
1
Versions
200
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-scan - npm Package Compare versions

Comparing version 1.7.1 to 1.8.0

lib/util/compiler.js

49

lib/index.js
const uniq = require("lodash.uniq");
const parser = require("./util/parser");
const compiler = require("./util/compiler");

@@ -19,3 +19,3 @@ const escape = input => String(input).replace(/[,.*[\]{}]/g, "\\$&");

const matches = (wildcard, input, arr, ctx) => Array.isArray(wildcard) ? wildcard.some(wc => matches(wc, input, arr, ctx)) : wildcard === (arr ? "[*]" : "*") || compare(wildcard, input, arr, ctx);
const matches = (wildcard, input, arr, ctx) => wildcard === (arr ? "[*]" : "*") || compare(wildcard, input, arr, ctx);

@@ -28,15 +28,9 @@ const formatPath = (input, ctx) => ctx.joined ? input.reduce((p, c) => {

const slice = array => Object.defineProperty(array.slice(1), "needle", {
value: array.needle,
writable: false
});
const find = (haystack, checks, pathIn, parents, ctx) => {
const find = (haystack, search, pathIn, parents, ctx) => {
const result = [];
const match = checks.find(check => check.length === 0);
if (match !== undefined) {
if (compiler.isFinal(search)) {
if (ctx.excludeFn === undefined || ctx.excludeFn(formatPath(pathIn, ctx), haystack, {
parents,
needle: match.needle
needles: compiler.getNeedles(search)
}) !== true) {

@@ -46,3 +40,3 @@ if (ctx.callbackFn !== undefined) {

parents,
needle: match.needle
needles: compiler.getNeedles(search)
});

@@ -57,3 +51,3 @@ }

parents,
needle: checks.reduce((p, c) => p.length > c.length ? c : p, checks[0]).needle
needles: compiler.getNeedles(search)
}) !== true) {

@@ -64,9 +58,9 @@ if (haystack instanceof Object) {

const pathOut = pathIn.concat(i);
checks.filter(check => check.length !== 0).forEach(check => {
Object.entries(search).forEach(([entry, subSearch]) => {
if (ctx.useArraySelector === false) {
result.push(...find(haystack[i], [check], pathOut, parents, ctx));
} else if (check[0] === "**") {
result.push(...find(haystack[i], [check, slice(check)], pathOut, parents.concat([haystack]), ctx));
} else if (matches(check[0], `[${i}]`, true, ctx)) {
result.push(...find(haystack[i], [slice(check)], pathOut, parents.concat([haystack]), ctx));
result.push(...find(haystack[i], search, pathOut, parents, ctx));
} else if (entry === "**") {
[subSearch, search].forEach(s => result.push(...find(haystack[i], s, pathOut, parents.concat([haystack]), ctx)));
} else if (matches(entry, `[${i}]`, true, ctx)) {
result.push(...find(haystack[i], subSearch, pathOut, parents.concat([haystack]), ctx));
}

@@ -79,7 +73,7 @@ });

const pathOut = pathIn.concat(key);
checks.filter(check => check.length !== 0).forEach(check => {
if (check[0] === "**") {
result.push(...find(value, [check, slice(check)], pathOut, parents.concat([haystack]), ctx));
} else if (matches(check[0], escapedKey, false, ctx)) {
result.push(...find(value, [slice(check)], pathOut, parents.concat([haystack]), ctx));
Object.entries(search).forEach(([entry, subSearch]) => {
if (entry === "**") {
[subSearch, search].forEach(s => result.push(...find(value, s, pathOut, parents.concat([haystack]), ctx)));
} else if (matches(entry, escapedKey, false, ctx)) {
result.push(...find(value, subSearch, pathOut, parents.concat([haystack]), ctx));
}

@@ -103,6 +97,3 @@ });

} = {}) => {
const search = uniq(needles).map(needle => Object.defineProperty(parser(needle), "needle", {
value: needle,
writable: false
}));
const search = compiler.compile(uniq(needles));
const regexCache = {};

@@ -119,2 +110,2 @@ return haystack => uniq(find(haystack, search, [], [], {

};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6WyJ1bmlxIiwicmVxdWlyZSIsInBhcnNlciIsImVzY2FwZSIsImlucHV0IiwiU3RyaW5nIiwicmVwbGFjZSIsImNvbXBhcmUiLCJ3aWxkY2FyZCIsImFyciIsImN0eCIsIm1hdGNoIiwicmVnZXhDYWNoZSIsInVuZGVmaW5lZCIsIlJlZ0V4cCIsInNwbGl0IiwibWFwIiwicCIsImpva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ICAgIGNvbnN0IHBhdGhPdXQgPSBwYXRoSW4uY29uY2F0KGkpO1xuICAgICAgICAgIGNoZWNrc1xuICAgICAgICAgICAgLmZpbHRlcihjaGVjayA9PiBjaGVjay5sZW5ndGggIT09IDApXG4gICAgICAgICAgICAuZm9yRWFjaCgoY2hlY2spID0+IHtcbiAgICAgICAgICAgICAgaWYgKGN0eC51c2VBcnJheVNlbGVjdG9yID09PSBmYWxzZSkge1xuICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKC4uLmZpbmQoaGF5c3RhY2tbaV0sIFtjaGVja10sIHBhdGhPdXQsIHBhcmVudHMsIGN0eCkpO1xuICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoZWNrWzBdID09PSBcIioqXCIpIHtcbiAgICAgICAgICAgICAgICByZXN1bHQucHVzaCguLi5maW5kKGhheXN0YWNrW2ldLCBbY2hlY2ssIHNsaWNlKGNoZWNrKV0sIHBhdGhPdXQsIHBhcmVudHMuY29uY2F0KFtoYXlzdGFja10pLCBjdHgpKTtcbiAgICAgICAgICAgICAgfSBlbHNlIGlmIChtYXRjaGVzKGNoZWNrWzBdLCBgWyR7aX1dYCwgdHJ1ZSwgY3R4KSkge1xuICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKC4uLmZpbmQoaGF5c3RhY2tbaV0sIFtzbGljZShjaGVjayldLCBwYXRoT3V0LCBwYXJlbnRzLmNvbmNhdChbaGF5c3RhY2tdKSwgY3R4KSk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBPYmplY3QuZW50cmllcyhoYXlzdGFjaykuZm9yRWFjaCgoW2tleSwgdmFsdWVdKSA9PiB7XG4gICAgICAgICAgY29uc3QgZXNjYXBlZEtleSA9IGVzY2FwZShrZXkpO1xuICAgICAgICAgIGNvbnN0IHBhdGhPdXQgPSBwYXRoSW4uY29uY2F0KGtleSk7XG4gICAgICAgICAgY2hl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ICAgICAgICAgICAgICAgICAucHVzaCguLi5maW5kKGhheXN0YWNrW2ldLCBzLCBwYXRoT3V0LCBwYXJlbnRzLmNvbmNhdChbaGF5c3RhY2tdKSwgY3R4KSkpO1xuICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1hdGNoZXMoZW50cnksIGBbJHtpfV1gLCB0cnVlLCBjdHgpKSB7XG4gICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goLi4uZmluZChoYXlzdGFja1tpXSwgc3ViU2VhcmNoLCBwYXRoT3V0LCBwYXJlbnRzLmNvbmNhdChbaGF5c3RhY2tdKSwgY3R4KSk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBPYmplY3QuZW50cmllcyhoYXlzdGFjaykuZm9yRWFjaCgoW2tleSwgdmFsdWVdKSA9PiB7XG4gICAgICAgICAgY29uc3QgZXNjYXBlZEtleSA9IGVzY2FwZShrZXkpO1xuICAgICAgICAgIGNvbnN0IHBhdGhPdXQgPSBwYXRoSW4uY29uY2F0KGtleSk7XG4gICAgICAgICAgT2JqZWN0LmVudHJpZXMoc2VhcmNoKVxuICAgICAgICAgICAgLmZvckVhY2goKFtlbnRyeSwgc3ViU2VhcmNoXSkgPT4ge1xuICAgICAgICAgICAgICBpZiAoZW50cnkgPT09IFwiKipcIikge1xuICAgICAgICAgICAgICAgIFtzdWJTZWFyY2gsIHNlYXJjaF0uZm9yRWFjaChzID0+IHJlc3VsdFxuICAgICAgICAgICAgICAgICAgLnB1c2goLi4uZmluZCh2YWx1ZSwgcywgcGF0aE91dCwgcGFyZW50cy5jb25jYXQoW2hheXN0YWNrXSksIGN0eCkpKTtcbiAgICAgICAgICAgICAgfSBlbHNlIGlmIChtYXRjaGVzKGVudHJ5LCBlc2NhcGVkS2V5LCBmYWxzZSwgY3R4KSkge1xuICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKC4uLmZpbmQodmFsdWUsIHN1YlNlYXJjaCwgcGF0aE91dCwgcGFyZW50cy5jb25jYXQoW2hheXN0YWNrXSksIGN0eCkpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG4gICAgICB9XG4gICAgfVxuICB9XG4gIHJldHVybiByZXN1bHQ7XG59O1xuXG5tb2R1bGUuZXhwb3J0cyA9IChuZWVkbGVzLCB7XG4gIGV4Y2x1ZGVGbiA9IHVuZGVmaW5lZCxcbiAgYnJlYWtGbiA9IHVuZGVmaW5lZCxcbiAgY2FsbGJhY2tGbiA9IHVuZGVmaW5lZCxcbiAgam9pbmVkID0gdHJ1ZSxcbiAgZXNjYXBlUGF0aHMgPSB0cnVlLFxuICB1c2VBcnJheVNlbGVjdG9yID0gdHJ1ZVxufSA9IHt9KSA9PiB7XG4gIGNvbnN0IHNlYXJjaCA9IGNvbXBpbGVyLmNvbXBpbGUodW5pcShuZWVkbGVzKSk7XG4gIGNvbnN0IHJlZ2V4Q2FjaGUgPSB7fTtcblxuICByZXR1cm4gaGF5c3RhY2sgPT4gdW5pcShmaW5kKGhheXN0YWNrLCBzZWFyY2gsIFtdLCBbXSwge1xuICAgIGV4Y2x1ZGVGbixcbiAgICBicmVha0ZuLFxuICAgIGNhbGxiYWNrRm4sXG4gICAgam9pbmVkLFxuICAgIHJlZ2V4Q2FjaGUsXG4gICAgZXNjYXBlUGF0aHMsXG4gICAgdXNlQXJyYXlTZWxlY3RvclxuICB9KSk7XG59O1xuIl19
{
"name": "object-scan",
"version": "1.7.1",
"version": "1.8.0",
"description": "Find Keys using Wildcard matching and optional value function.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -45,7 +45,7 @@ # Object-Scan

**Note on Functions:**
Signature for all functions is `Fn(key, value, { parents, needle })`, where:
Signature for all functions is `Fn(key, value, { parents, needles })`, where:
- `key` is the key that the function is called for (respects `joined` option).
- `value` is the value of that key.
- `parents` is an array containing all parents as `[..., grandparent, parent]` (includes arrays iff `useArraySelector` is true).
- `needle` is a needle that triggered the function call.
- `needles` are all needles that triggered the function call.

@@ -153,3 +153,3 @@ #### excludeFn

objectScan(["**"], { breakFn: key => key === "a.b" })(obj);
// => ["a", "a.b", "a.e", "a.e.f", "a.h", "a.h[0]", "a.h[1]", "k"]);
// => ["a", "a.b", "a.e", "a.e.f", "a.h", "a.h[0]", "a.h[1]", "k"]
```

@@ -156,0 +156,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc