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

numenor

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

numenor - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

41

lib/Compiler/Evaluator/Identifier.js

@@ -35,17 +35,32 @@ "use strict";

if (options.Constants && contains(options.Constants, name)) {
const value = options.Constants[name];
if (options.Constants) {
let constValue = undefined;
if (typeof value === 'function') {
return (0, _.makeConstEval)((0, _util.bindFunction)(value, options.Constants));
if (contains(options.Constants, name)) {
constValue = options.Constants[name];
} else if (contains(options.Constants, _.ValueLookup)) {
constValue = options.Constants[_.ValueLookup](name);
}
return (0, _.makeConstEval)(value);
if (constValue !== undefined) {
if (typeof constValue === 'function') {
return (0, _.makeConstEval)((0, _util.bindFunction)(constValue, options.Constants));
}
return (0, _.makeConstEval)(constValue);
}
}
const get = options.NoProtoAccess ? _util.ownPropGetter : (0, _util.makeProtoPropGetter)(options);
return context => {
let value = get(context, name);
const evaluator = context => {
const value = get(context, name);
if (value === undefined && contains(context, _.ValueLookup)) {
value = context[_.ValueLookup](name);
}
if (options.NoUndefinedVars && value === undefined) {
throw new ReferenceError((0, _Error.UndefinedIdentifier)(name));
}
if (typeof value === 'function') {

@@ -57,16 +72,4 @@ return (0, _util.bindFunction)(value, context);

};
if (options.NoUndefinedVars) {
return (context, stack) => {
if (!contains(context, name)) {
throw new ReferenceError((0, _Error.UndefinedIdentifier)(name));
}
return evaluator(context, stack);
};
}
return evaluator;
};
exports.Identifier = Identifier;

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

exports.evalConst = evalConst;
exports.AsyncValue = exports.ConstValue = void 0;
exports.ValueLookup = exports.AsyncValue = exports.ConstValue = void 0;
const ConstValue = Symbol('const');

@@ -17,2 +17,4 @@ exports.ConstValue = ConstValue;

exports.AsyncValue = AsyncValue;
const ValueLookup = Symbol('lookup');
exports.ValueLookup = ValueLookup;

@@ -19,0 +21,0 @@ function mark(attrib, evaluator) {

{
"name": "numenor",
"version": "0.1.0",
"version": "0.1.1",
"description": "Customizable, safe evaluator of JavaScript-like expressions.",

@@ -5,0 +5,0 @@ "keywords": [

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