0.9.7 • Published 2 years ago

@bygdle/expr-parser v0.9.7

Weekly downloads
-
License
-
Repository
-
Last release
2 years 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

2 years ago

0.9.6

2 years ago

0.9.5

2 years ago

0.9.4

2 years ago

0.9.3

2 years ago

0.9.2

2 years ago

0.9.1

2 years ago

0.9.0

2 years ago

0.8.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago