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

math-expression-evaluator

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

math-expression-evaluator

A flexible math expression evaluator

  • 1.2.16
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2M
decreased by-1.15%
Maintainers
1
Weekly downloads
 
Created

What is math-expression-evaluator?

The math-expression-evaluator is an npm package that allows for parsing and evaluating mathematical expressions. It can handle various mathematical operations, including basic arithmetic, logical operations, and functions.

What are math-expression-evaluator's main functionalities?

Evaluating Mathematical Expressions

This feature allows for the evaluation of a string-based mathematical expression, including support for functions like square root.

var mexp = require('math-expression-evaluator');
var result = mexp.eval('2+3*sqrt(4)');

Support for Variables in Expressions

This feature enables the evaluation of expressions with variables, where the values of the variables can be provided as an object.

var mexp = require('math-expression-evaluator');
var result = mexp.eval('x^2 + y', {x: 3, y: 4});

Custom Functions

This feature allows users to add custom functions to the evaluator, which can then be used in expressions.

var mexp = require('math-expression-evaluator');
mexp.addToken([
  {type: 3, token: 'sum', show: 'sum', value: function(a, b) { return a + b; }}
]);
var result = mexp.eval('sum(1,2)');

Logical Operations

This feature supports logical operations within expressions, enabling the evaluation of expressions that include logical comparisons.

var mexp = require('math-expression-evaluator');
var result = mexp.eval('1 < 2 && 3 > 2');

Other packages similar to math-expression-evaluator

Keywords

FAQs

Package last updated on 02 Feb 2017

Did you know?

Socket

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.

Install

Related posts

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