New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

object-rewrite

Package Overview
Dependencies
Maintainers
1
Versions
181
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 10.0.3 to 10.0.4

1

lib/module/plugin.js

@@ -144,2 +144,3 @@ import assert from 'assert';

schema,
isAsync: fn[Symbol.toStringTag] === 'AsyncFunction',
onInit: (context, logger) => handleCb({

@@ -146,0 +147,0 @@ type: 'init',

13

lib/module/rewriter.js

@@ -56,7 +56,8 @@ import assert from 'assert';

assert(context instanceof Object && !Array.isArray(context));
const { promises } = injectRewriter(input, {
const { promises, sync } = injectRewriter(input, {
injectMap: initPluginMap(injectMap, input, context, logger),
promises: []
promises: [],
sync: []
});
return promises;
return { promises, sync };
};

@@ -78,4 +79,5 @@ const rewriteEnd = (input, context) => {

const context = { ...context_, ...initContext };
const promises = rewriteStart(input, context);
const { sync, promises } = rewriteStart(input, context);
assert(promises.length === 0, 'Please use rewriteAsync() for async logic');
sync.map((f) => f());
rewriteEnd(input, context);

@@ -85,4 +87,5 @@ },

const context = { ...context_, ...initContext };
const promises = rewriteStart(input, context);
const { sync, promises } = rewriteStart(input, context);
await Promise.all(promises.map((p) => p()));
sync.map((f) => f());
rewriteEnd(input, context);

@@ -89,0 +92,0 @@ }

@@ -27,2 +27,3 @@ import assert from 'assert';

const promises = [];
const sync = [];
plugins.forEach((plugin) => {

@@ -36,12 +37,15 @@ const exec = (r) => {

};
const result = plugin.fn(kwargs);
if (result instanceof Promise) {
promises.push(async () => exec(await result));
if (plugin.self.meta.isAsync) {
promises.push(async () => {
const r = await plugin.fn(kwargs);
return exec(r);
});
} else {
exec(result);
sync.push(() => exec(plugin.fn(kwargs)));
}
});
context.promises.push(...promises);
context.sync.push(...sync);
return true;
}
});
{
"name": "object-rewrite",
"type": "module",
"version": "10.0.3",
"version": "10.0.4",
"description": "Rewrite Object(s) in place using plugins.",

@@ -6,0 +6,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