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 2.1.3 to 2.1.4

38

lib/index.js

@@ -22,30 +22,34 @@ const assert = require('assert');

isMatch,
needle,
matchedBy,
parents
}) => {
assert(isMatch === true);
matchedBy.sort();
if (filter[needle] !== undefined && filter[needle](key, value, parents) === false) {
if (matchedBy.some(n => filter[n] !== undefined && filter[n](key, value, parents) === false)) {
toRemove.push(key);
}
if (retain.includes(needle)) {
if (matchedBy.some(n => retain.includes(n))) {
toRetain.push(key);
}
if (inject[needle] !== undefined) {
Object.assign(value, inject[needle](key, value, parents));
}
matchedBy.forEach(n => {
if (inject[n] !== undefined) {
Object.assign(value, inject[n](key, value, parents));
}
});
matchedBy.forEach(n => {
if (overwrite[n] !== undefined) {
const lastStringIndex = key.reduce((p, c, idx) => typeof c === 'string' ? idx : p, 0);
const directParent = key.slice(lastStringIndex, -1).reduce((p, c) => p[c], parents[0]); // eslint-disable-next-line no-param-reassign
if (overwrite[needle] !== undefined) {
const lastStringIndex = key.reduce((p, c, idx) => typeof c === 'string' ? idx : p, 0);
const directParent = key.slice(lastStringIndex, -1).reduce((p, c) => p[c], parents[0]); // eslint-disable-next-line no-param-reassign
directParent[key.slice(-1)[0]] = overwrite[needle](key, value, parents);
}
directParent[key.slice(-1)[0]] = overwrite[n](key, directParent[key.slice(-1)[0]], parents);
}
});
},
arrayCallbackFn: (key, value, {
needle
matchedBy
}) => {
if (retain.includes(needle)) {
if (matchedBy.some(n => retain.includes(n))) {
toRetain.push(key);

@@ -55,5 +59,5 @@ }

breakFn: (key, value, {
needles: ndls
traversedBy
}) => {
if (retainEmptyParents === true && ndls.some(ndl => retain.includes(ndl))) {
if (retainEmptyParents === true && traversedBy.some(n => retain.includes(n))) {
toRetain.push(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c3QgZGlyZWN0UGFyZW50ID0ga2V5LnNsaWNlKGxhc3RTdHJpbmdJbmRleCwgLTEpLnJlZHVjZSgocCwgYykgPT4gcFtjXSwgcGFyZW50c1swXSk7XG4gICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLXBhcmFtLXJlYXNzaWduXG4gICAgICAgICAgZGlyZWN0UGFyZW50W2tleS5zbGljZSgtMSlbMF1dID0gb3ZlcndyaXRlW25dKGtleSwgZGlyZWN0UGFyZW50W2tleS5zbGljZSgtMSlbMF1dLCBwYXJlbnRzKTtcbiAgICAgICAgfVxuICAgICAgfSk7XG4gICAgfSxcbiAgICBhcnJheUNhbGxiYWNrRm46IChrZXksIHZhbHVlLCB7IG1hdGNoZWRCeSB9KSA9PiB7XG4gICAgICBpZiAobWF0Y2hlZEJ5LnNvbWUobiA9PiByZXRhaW4uaW5jbHVkZXMobikpKSB7XG4gICAgICAgIHRvUmV0YWluLnB1c2goa2V5KTtcbiAgICAgIH1cbiAgICB9LFxuICAgIGJyZWFrRm46IChrZXksIHZhbHVlLCB7IHRyYXZlcnNlZEJ5IH0pID0+IHtcbiAgICAgIGlmIChyZXRhaW5FbXB0eVBhcmVudHMgPT09IHRydWUgJiYgdHJhdmVyc2VkQnkuc29tZShuID0+IHJldGFpbi5pbmNsdWRlcyhuKSkpIHtcbiAgICAgICAgdG9SZXRhaW4ucHVzaChrZXkpO1xuICAgICAgfVxuICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH1cbiAgfSk7XG5cbiAgcmV0dXJuIChpbnB1dCkgPT4ge1xuICAgIHNjYW5uZXIoaW5wdXQpO1xuICAgIHRyZWUucHJ1bmUoaW5wdXQsIHRvUmVtb3ZlLCB0b1JldGFpbik7XG4gICAgdG9SZW1vdmUubGVuZ3RoID0gMDtcbiAgICB0b1JldGFpbi5sZW5ndGggPSAwO1xuICB9O1xufTtcbiJdfQ==
{
"name": "object-rewrite",
"version": "2.1.3",
"version": "2.1.4",
"description": "Rewrite an Object",

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

"dependencies": {
"object-scan": "2.1.1"
"object-scan": "3.0.0"
},

@@ -16,11 +16,11 @@ "devDependencies": {

"chai": "4.2.0",
"coveralls": "3.0.2",
"js-gardener": "1.35.0",
"coveralls": "3.0.3",
"js-gardener": "1.37.4",
"nyc": "13.3.0",
"semantic-release": "15.13.3",
"@babel/register": "7.0.0",
"@babel/core": "7.3.3",
"@babel/core": "7.3.4",
"@babel/cli": "7.2.3",
"@babel/plugin-transform-flow-comments": "7.2.0",
"@babel/plugin-proposal-object-rest-spread": "7.3.2",
"@babel/plugin-proposal-object-rest-spread": "7.3.4",
"@babel/preset-flow": "7.0.0"

@@ -27,0 +27,0 @@ },

@@ -112,5 +112,5 @@ # object-rewrite

## Deficiencies
## Edge Cases
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.
When different matchers target the same elements, all matcher functions are run in key-alphabetical order.
Example of multi targeting would be e.g. using `**` and `*.field`.
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