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.1.4 to 2.0.0

24

lib/index.js

@@ -8,3 +8,3 @@ const assert = require("assert");

module.exports = ({
exclude = {},
filter = {},
inject = {},

@@ -14,5 +14,5 @@ overwrite = {},

}) => {
const needles = [...Object.keys(exclude), ...Object.keys(inject), ...Object.keys(overwrite), ...retain];
const excluded = [];
const retained = [];
const needles = [...Object.keys(filter), ...Object.keys(inject), ...Object.keys(overwrite), ...retain];
const toRemove = [];
const toRetain = [];
const scanner = objectScan(needles, {

@@ -28,8 +28,8 @@ useArraySelector: false,

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

@@ -52,3 +52,3 @@

if (retain.includes(needle)) {
retained.push(key);
toRetain.push(key);
}

@@ -59,7 +59,7 @@ }

scanner(input);
tree.prune(input, excluded, retained);
excluded.length = 0;
retained.length = 0;
tree.prune(input, toRemove, toRetain);
toRemove.length = 0;
toRetain.length = 0;
};
};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6WyJhc3NlcnQiLCJyZXF1aXJlIiwib2JqZWN0U2NhbiIsInRyZWUiLCJtb2R1bGUiLCJleHBvcnRzIiwiZXhjbHVkZSIsImluamVjdCIsIm92ZXJ3cml0ZSIsInJldGFpbiIsIm5lZWRsZXMiLCJPYmplY3QiLCJrZXlzIiwiZXhjbHVkZWQiLCJyZXRhaW5lZCIsInNjYW5uZXIiLCJ1c2VBcnJheVNlbGVjdG9yI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GUtbmV4dC1saW5lIG5vLXBhcmFtLXJlYXNzaWduXG4gICAgICAgIGRpcmVjdFBhcmVudFtrZXkuc2xpY2UoLTEpWzBdXSA9IG92ZXJ3cml0ZVtuZWVkbGVdKGtleSwgdmFsdWUsIHBhcmVudHMpO1xuICAgICAgfVxuICAgIH0sXG4gICAgYXJyYXlDYWxsYmFja0ZuOiAoa2V5LCB2YWx1ZSwgeyBuZWVkbGUgfSkgPT4ge1xuICAgICAgaWYgKHJldGFpbi5pbmNsdWRlcyhuZWVkbGUpKSB7XG4gICAgICAgIHRvUmV0YWluLnB1c2goa2V5KTtcbiAgICAgIH1cbiAgICB9XG4gIH0pO1xuXG4gIHJldHVybiAoaW5wdXQpID0+IHtcbiAgICBzY2FubmVyKGlucHV0KTtcbiAgICB0cmVlLnBydW5lKGlucHV0LCB0b1JlbW92ZSwgdG9SZXRhaW4pO1xuICAgIHRvUmVtb3ZlLmxlbmd0aCA9IDA7XG4gICAgdG9SZXRhaW4ubGVuZ3RoID0gMDtcbiAgfTtcbn07XG4iXX0=

@@ -30,3 +30,3 @@ const LEAF = Symbol("leaf");

const pruneRec = (input, exclude, retain) => {
const pruneRec = (input, remove, retain) => {
const isArray = Array.isArray(input);

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

inputEntries.forEach(([key, value]) => {
if (exclude[key] !== undefined && isLeaf(exclude[key]) || retain[key] === undefined) {
if (remove[key] !== undefined && isLeaf(remove[key]) || retain[key] === undefined) {
if (isArray) {

@@ -50,3 +50,3 @@ input.splice(key, 1);

} else if (value instanceof Object) {
pruneRec(value, exclude[key] || {}, retain[key]);
pruneRec(value, remove[key] || {}, retain[key]);
}

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

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

@@ -10,3 +10,3 @@ "main": "lib/index.js",

"dependencies": {
"object-scan": "1.12.0"
"object-scan": "2.0.0"
},

@@ -13,0 +13,0 @@ "devDependencies": {

@@ -12,3 +12,3 @@ [![Build Status](https://circleci.com/gh/blackflux/object-rewrite.png?style=shield)](https://circleci.com/gh/blackflux/object-rewrite)

Rewrite an Object by defining exactly what gets excluded, injected and retained.
Rewrite an Object by defining exactly what gets filtered, injected and retained.

@@ -47,5 +47,5 @@ ## Install

const rewriter = objectRewrite({
exclude: {
"": (key, value, parents) => value.active !== "yes",
tags: (key, value, parents) => value.id !== 4
filter: {
"": (key, value, parents) => value.active === "yes",
tags: (key, value, parents) => value.id === 4
},

@@ -89,5 +89,5 @@ inject: {

### Exclude
### Filter
Takes object where keys are needles and values are functions. The matches for a needle are removed from the object iff the corresponding function execution returns true.
Takes object where keys are needles and values are functions. The matches for a needle are removed from the object iff the corresponding function execution returns false.

@@ -104,7 +104,7 @@ ### Inject

Array of needles. Matches are kept if not excluded previously. All entries not matched are excluded. Defaults to `["**"]` which matches all entries.
Array of needles. Matches are kept if not filtered previously. All entries not matched are removed. Defaults to `["**"]` which matches all entries.
## Deficiencies
Problems when different matchers are used between exclude, inject, overwrite, retain that target the same elements.
Problems when different matchers are used between filter, inject, overwrite, retain that target the same elements.
E.g. using `**` for retain, but `*.field` for inject.
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