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

static-eval

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

static-eval - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

6

index.js

@@ -107,3 +107,7 @@ var unparse = require('escodegen').generate;

else if (node.type === 'FunctionExpression') {
return Function('return ' + unparse(node))();
var keys = Object.keys(vars);
var vals = keys.map(function(key) {
return vars[key];
});
return Function(keys.join(', '), 'return ' + unparse(node)).apply(null, vals);
}

@@ -110,0 +114,0 @@ else return FAIL;

2

package.json
{
"name": "static-eval",
"version": "0.2.3",
"version": "0.2.4",
"description": "evaluate statically-analyzable expressions",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -45,2 +45,10 @@ var test = require('tape');

t.deepEqual(evaluate(ast), [2, 4, 6]);
})
});
test('array methods with vars', function(t) {
t.plan(1);
var src = '[1, 2, 3].map(function(n) { return n * x })';
var ast = parse(src).body[0].expression;
t.deepEqual(evaluate(ast, {x: 2}), [2, 4, 6]);
});
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