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

@marterrez/eval-expression

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@marterrez/eval-expression - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

6

dist/index.js

@@ -33,3 +33,2 @@ "use strict";

eval(exp, params = {}) {
if (!exp || !exp.length || typeof exp !== 'string') return null;
const ctx = { ...this.context,

@@ -39,7 +38,8 @@ ...params

if (this.opts.debgger) {
console.log(`* ExpressionParser: eval ${exp}`);
if (this.opts.debugger) {
console.log(`* ExpressionParser: eval '${exp}'`);
console.log(`* context = ${JSON.stringify(ctx, null, 2)}`);
}
if (!exp || !exp.length || typeof exp !== 'string') return null;
const returnValue = exp.indexOf('return') > -1 ? exp : `return ${exp}`; // eslint-disable-next-line no-new-func

@@ -46,0 +46,0 @@

{
"name": "@marterrez/eval-expression",
"version": "0.0.5",
"version": "0.0.6",
"description": "Small lib that allows to eval a string containing javascript code. It allows you do inject helper functions when evaluating the expression",

@@ -13,3 +13,3 @@ "main": "dist/index.js",

"test:unit": "jest",
"test:watch": "jest --watch",
"test:watch": "jest --watchAll",
"coverage": "./node_modules/.bin/codecov"

@@ -16,0 +16,0 @@ },

@@ -18,4 +18,2 @@ import * as lodash from 'lodash'

eval (exp, params = {}) {
if (!exp || !exp.length || typeof exp !== 'string') return null
const ctx = {

@@ -25,6 +23,7 @@ ...this.context,

}
if (this.opts.debgger) {
console.log(`* ExpressionParser: eval ${exp}`)
if (this.opts.debugger) {
console.log(`* ExpressionParser: eval '${exp}'`)
console.log(`* context = ${JSON.stringify(ctx, null, 2)}`)
}
if (!exp || !exp.length || typeof exp !== 'string') return null

@@ -31,0 +30,0 @@ const returnValue = exp.indexOf('return') > -1 ? exp : `return ${exp}`

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