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 4.3.1 to 4.3.2

7

lib/module/rewriter/mk-filter-rewriter.js

@@ -7,4 +7,2 @@ "use strict";

const execPlugins = require('./exec-plugins');
module.exports = keys => objectScan(keys, {

@@ -29,3 +27,3 @@ useArraySelector: false,

const parents = getParents();
const result = execPlugins('FILTER', plugins, {
const kwargs = {
key,

@@ -35,3 +33,4 @@ value,

context: context.context
}) === true;
};
const result = plugins.every(plugin => plugin.fn(kwargs)) === true;

@@ -38,0 +37,0 @@ if (result === false) {

@@ -7,3 +7,3 @@ "use strict";

const execPlugins = require('./exec-plugins');
const set = require('lodash.set');

@@ -29,3 +29,3 @@ module.exports = keys => objectScan(keys, {

const parents = getParents();
const promises = execPlugins('INJECT', plugins, {
const kwargs = {
key,

@@ -35,2 +35,22 @@ value,

context: context.context
};
const promises = [];
plugins.forEach(plugin => {
const exec = r => {
assert(plugin.schema(r) === true);
if (plugin.targetRel === '*') {
Object.assign(kwargs.value, r);
} else {
set(kwargs.value, plugin.targetRel, r);
}
};
const result = plugin.fn(kwargs);
if (result instanceof Promise) {
promises.push(async () => exec(await result));
} else {
exec(result);
}
});

@@ -37,0 +57,0 @@ context.promises.push(...promises);

@@ -7,4 +7,2 @@ "use strict";

const execPlugins = require('./exec-plugins');
const cmpFn = require('../../util/cmp-fn');

@@ -38,3 +36,3 @@

const lookup = context.lookups[key.length - 1];
lookup.set(value, execPlugins('SORT', plugins, {
const kwargs = {
key,

@@ -44,3 +42,4 @@ value,

context: context.context
}));
};
lookup.set(value, plugins.map(plugin => plugin.fn(kwargs)));

@@ -47,0 +46,0 @@ if (key[key.length - 1] === 0) {

{
"name": "object-rewrite",
"version": "4.3.1",
"version": "4.3.2",
"description": "Rewrite Object(s) in place using plugins.",

@@ -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