1.0.2 • Published 7 years ago

math-equation-parser v1.0.2

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

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
  }
}