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

node-retrieve-globals

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-retrieve-globals - npm Package Compare versions

Comparing version 2.0.3 to 2.0.4

4

package.json
{
"name": "node-retrieve-globals",
"version": "2.0.3",
"version": "2.0.4",
"description": "Execute a string of JavaScript using Node.js and return the global variable values and functions.",

@@ -21,3 +21,3 @@ "type": "module",

"devDependencies": {
"@zachleat/noop": "^1.0.2",
"@zachleat/noop": "^1.0.3",
"ava": "^5.2.0"

@@ -24,0 +24,0 @@ },

@@ -69,1 +69,13 @@ # node-retrieve-globals

```
### Advanced options
```js
// Defaults shown
let options = {
reuseGlobal: false, // re-use Node.js `global`, important if you want `console.log` to log to your console as expected.
dynamicImport: false, // allows `import()`
};
await vm.getGlobalContext({}, options);

@@ -51,3 +51,20 @@ import test from "ava";

test("import", async t => {
test("destructured assignment via object", async t => {
let vm = new RetrieveGlobals(`const { a } = { a: 1 };`);
let ret = await vm.getGlobalContext();
t.is(typeof ret.a, "number");
t.is(ret.a, 1);
});
test("destructured assignment via Array", async t => {
let vm = new RetrieveGlobals(`const [a, b] = [1, 2];`);
let ret = await vm.getGlobalContext();
t.is(typeof ret.a, "number");
t.is(typeof ret.b, "number");
t.is(ret.a, 1);
t.is(ret.b, 2);
});
test("dynamic import", async t => {
let vm = new RetrieveGlobals(`const { noop } = await import("@zachleat/noop");`);

@@ -80,1 +97,2 @@ let ret = await vm.getGlobalContext(undefined, {

});

Sorry, the diff of this file is not supported yet

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