Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
simple-evaluate
Advanced tools
[![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][coveralls-image]][coveralls-url] [![npm download][download-image]][download-url]
A safe parse for simple js expression.
import evaluate from 'simple-evaluate';
evaluate(null, '12 + 1 > 14');
evaluate({ a }, 'a + 1 > 14');
+ - * / %
a ? b : c
> < >= <= == != === !==
&& || !
You can run those expression, for example:
evaluate({}, '!a > 0');
evaluate({}, 'a > 0 || a < -12 || 12 + 2*(4 + 4) < 12');
evaluate({ a: 1 }, '-a * 2');
$.
stand for the root value all context
, value path only support '.', and not support function call.
since 1.2.0,
$.
is optional. That mean$.a.b
is equal toa.b
String and boolean support, string start with ' | "
, just the same as javascript expression.
Boolean use two key words, true | false
.
You can use template string, just like the javascript syntax, for example.
evaluate({ a: 22 }, "`I am ${ a >= 18 ? 'adult' : 'child' }`").should.equal('I am adult');
So, you can not run those expression
evaluation({}, 'a(1) > 0');
FAQs
[![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][coveralls-image]][coveralls-url] [![npm download][download-image]][download-url]
The npm package simple-evaluate receives a total of 670 weekly downloads. As such, simple-evaluate popularity was classified as not popular.
We found that simple-evaluate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.