static-eval
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -79,2 +79,5 @@ var unparse = require('escodegen').generate; | ||
var ctx = node.callee.object ? walk(node.callee.object) : FAIL; | ||
if (ctx === FAIL) ctx = null; | ||
var args = []; | ||
@@ -86,3 +89,3 @@ for (var i = 0, l = node.arguments.length; i < l; i++) { | ||
} | ||
return callee.apply(null, args); | ||
return callee.apply(ctx, args); | ||
} | ||
@@ -89,0 +92,0 @@ else if (node.type === 'MemberExpression') { |
{ | ||
"name": "static-eval", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "evaluate statically-analyzable expressions", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -38,1 +38,9 @@ var test = require('tape'); | ||
}); | ||
test('array methods', function(t) { | ||
t.plan(1); | ||
var src = '[1, 2, 3].map(function(n) { return n * 2 })'; | ||
var ast = parse(src).body[0].expression; | ||
t.deepEqual(evaluate(ast), [2, 4, 6]); | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9922
170