Parses infix mathematical expressions and outputs an json rule object
json-logic-parser
is a lightweight mathematical parser that creates JsonLogic rule objects out of mathematical expressions in infix notation
Based on Mauricio Poppe's mr-parser
var Parser = require('json-logic-parser').Parser;
Parser.parse('1 - (2 + 3) * 4')
// returns
[
{
"-": [
"1",
{
"*": [
{
"+": [
"2",
"3"
]
},
"4"
]
}
]
}
]
params
expression
{string} the expression to be parsed
returns
- Returns a JsonLogic rule object.
2018 MIT © Rauno Kulla