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

object-rewrite

Package Overview
Dependencies
Maintainers
1
Versions
179
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-rewrite - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

16

lib/index.js

@@ -13,4 +13,4 @@ const assert = require("assert");

const needles = [...Object.keys(exclude), ...Object.keys(inject), ...retain];
const excluded = [];
const retained = [];
const excluded = [];
const scanner = objectScan(needles, {

@@ -26,2 +26,6 @@ useArraySelector: false,

if (exclude[needle] !== undefined && exclude[needle](key, value, parents) === true) {
excluded.push(key);
}
if (retain.includes(needle)) {

@@ -31,6 +35,2 @@ retained.push(key);

if (exclude[needle] !== undefined && exclude[needle](key, value, parents) === true) {
excluded.push(key);
}
if (inject[needle] !== undefined) {

@@ -43,7 +43,7 @@ Object.assign(value, inject[needle](key, value, parents));

scanner(input);
tree.prune(input, retained, excluded);
tree.prune(input, excluded, retained);
excluded.length = 0;
retained.length = 0;
excluded.length = 0;
};
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6WyJhc3NlcnQiLCJyZXF1aXJlIiwib2JqZWN0U2NhbiIsInRyZWUiLCJtb2R1bGUiLCJleHBvcnRzIiwiZXhjbHVkZSIsImluamVjdCIsInJldGFpbiIsIm5lZWRsZXMiLCJPYmplY3QiLCJrZXlzIiwicmV0YWluZWQiLCJleGNsdWRlZCIsInNjYW5uZXIiLCJ1c2VBcnJheVNlbGVjdG9yIiwiam9pbmVkIiwiY2FsbGJhY2tGbiIsImtleSIsInZhbHVlIiwiaXNNYXRjaCIsIm5lZWRsZSIsInBhcmVudHMiLCJpbmNsdWRlcyIsInB1c2giLCJ1bmRlZmluZWQiLCJhc3NpZ24iLCJpbnB1dCIsInBydW5lIiwibGVuZ3RoIl0sI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.exports.isLeaf = isLeaf;
const build = needles => {

@@ -27,3 +29,5 @@ const result = {};

const pruneRec = (input, retain, exclude) => {
module.exports.build = build;
const pruneRec = (input, exclude, retain) => {
const isArray = Array.isArray(input);

@@ -46,3 +50,3 @@ const inputEntries = Object.entries(input);

} else {
pruneRec(value, retain[key], exclude[key] || {});
pruneRec(value, exclude[key] || {}, retain[key]);
}

@@ -52,5 +56,5 @@ });

module.exports.prune = (input, retain, exclude) => {
pruneRec(input, build(retain), build(exclude));
module.exports.prune = (input, exclude, retain) => {
pruneRec(input, build(exclude), build(retain));
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL3RyZWUuanMiXSwibmFtZXMiOlsiTEVBRiIsIlN5bWJvbCIsIm1hcmtMZWFmIiwiaW5wdXQiLCJPYmplY3QiLCJkZWZpbmVQcm9wZXJ0eSIsInZhbHVlIiwid3JpdGFibGUiLCJpc0xlYWYiLCJidWlsZCIsIm5lZWRsZXMiLCJyZXN1bHQiLCJmb3JFYWNoIiwiYnJhbmNoIiwiZWxlIiwic2VnIiwidW5kZWZpbmVkIiwicHJ1bmVSZWMiLCJyZXRhaW4iLCJleGNsdWRlIiwiaXNBcnJheSIsIkFycmF5IiwiaW5wdXRFbnRyaWVzIiwiZW50cmllcyIsInNvcnQiLCJhIiwiYiIsInBhcnNlSW50Iiwia2V5Iiwic3BsaWNlIiwibW9kdWxlIiwiZXhwb3J0cyIsInBydW5lIl0sIm1hcHBpbmdzIjoiQUFBQSxNQUFNQSxPQUFPQyxPQUFPLE1BQVAsQ0FBYjs7QUFFQSxNQUFNQyxXQUFXQyxTQUFTQyxPQUFPQyxjQUFQLENBQXNCRixLQUF0QixFQUE2QkgsSUFBN0IsRUFBbUM7QUFBRU0sU0FBTyxJQUFUO0FBQWVDLFlBQVU7QUFBekIsQ0FBbkMsQ0FBMUI7O0FBQ0EsTUFBTUMsU0FBU0wsU0F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haW5ba2V5XSk7XG4gICAgfVxuICB9KTtcbn07XG5cbm1vZHVsZS5leHBvcnRzLnBydW5lID0gKGlucHV0LCBleGNsdWRlLCByZXRhaW4pID0+IHtcbiAgcHJ1bmVSZWMoaW5wdXQsIGJ1aWxkKGV4Y2x1ZGUpLCBidWlsZChyZXRhaW4pKTtcbn07XG4iXX0=
{
"name": "object-rewrite",
"version": "1.0.5",
"version": "1.0.6",
"description": "Rewrite an Object",

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

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