
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
built-in-math-eval
Advanced tools
Evaluate mathematical expression with the built-in math object
Evaluate mathematical expression with the built-in math object
Table of Contents generated with DocToc
This module evaluates the generated code from math-codegen
for the built in Math
namespace providing the necessary adapter methods
$ npm install --save built-in-math-eval
var compile = require('built-in-math-eval');
code = compile(expression)
params
expression
{string} the expression to be parsedreturns {Object}
return.eval
{function} The compiled function to be called with some scope variablesreturn.eval([scope])
params
scope
{Object}An optional object which holds some variables to be used in the expression,
all variables are casted to Number
returns {*} a number or a boolean value depending on the operation made
Also have a look at test/index.js
var compile = require('built-in-math-eval');
// > 3
compile('1 + 2').eval()
// > 8
compile('2^3').eval()
// > 8
compile('x^3').eval({ x: 2 })
// > 1
compile('cos(x)').eval({ x: 0 })
// > 8
compile('2x^2').eval({ x: 2 })
// > 3.1415
compile('PI').eval()
2015 © Mauricio Poppe
FAQs
Evaluate mathematical expression with the built-in math object
The npm package built-in-math-eval receives a total of 232 weekly downloads. As such, built-in-math-eval popularity was classified as not popular.
We found that built-in-math-eval 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.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.