0.9.7 • Published 4 months ago

@bygdle/expr-parser v0.9.7

Weekly downloads
-
License
-
Repository
-
Last release
4 months ago

Expr parser

Parses and evaluates mathematical expressions with custom functions and variables.

https://github.com/NiuWeb/expr-parser

Installation

npm install @bygdle/expr-parser

Usage example

import { Parser } from "@bygdle/expr-parser"
const parser = new Parser({
  functions: {
    log: { // a custom function log
      arguments: 1,
      evaluate: ([arg]) => {
        return Math.log(arg)
      }
    }
  },
  variables: {
    pi: Math.PI
  }
})

const expr = parser.parse("log(pi) + 1")
console.log(expr.evaluate())

parset.setVar("pi", 3)
console.log(expr.evaluate())
0.9.7

4 months ago

0.9.6

6 months ago

0.9.5

6 months ago

0.9.4

6 months ago

0.9.3

6 months ago

0.9.2

6 months ago

0.9.1

6 months ago

0.9.0

6 months ago

0.8.0

6 months ago

0.7.0

6 months ago

0.6.0

6 months ago

0.5.0

6 months ago

0.4.0

6 months ago

0.3.0

9 months ago

0.2.0

9 months ago

0.1.0

9 months ago