Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-logic-parser

Parses infix mathematical expressions and outputs an json rule object

Description

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

Usage

var Parser = require('json-logic-parser').Parser;
Parser.parse('1 - (2 + 3) * 4')

// returns
[
  {
    "-": [
      "1",
      {
        "*": [
          {
            "+": [
              "2",
              "3"
            ]
          },
          "4"
        ]
      }
    ]
  }
]

API

Parser = require('json-logic-parser').Parser

Parser.parse(expression)

params

  • expression {string} the expression to be parsed

returns

  • Returns a JsonLogic rule object.

2018 MIT © Rauno Kulla

About

parses infix mathematical expressions and outputs an json logic rule object that represents the expression

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages