math-equation-parser

1.0.2 • Public • Published

Math Equation Parser

A library for parsing math equations in Javascript.

Features

  • Custom Binary Operators
  • Custom Function Operators
  • Implicit Multiplication
  • Math Symbols ('x', 'y', etc...)
  • Configure for Left and Right Associativity

Basic Usage

ES6 Imports
import Parser from 'math-equation-parser';

console.log(Parser.parse('1 + 2'));
Common JS
const Parser = require('math-equation-parser');

console.log(Parser.parse('1 + 2'));
Printed Value
{
  "type": "BinaryOperator",
  "name": "Sum",
  "left": {
    "type": "Literal",
    "name": "Literal",
    "value": 1
  },
  "right": {
    "type": "Literal",
    "name": "Literal",
    "value": 2
  }
}

/math-equation-parser/

    Package Sidebar

    Install

    npm i math-equation-parser

    Weekly Downloads

    1

    Version

    1.0.2

    License

    ISC

    Last publish

    Collaborators

    • brenmcnamara