blesstosam / expr-parser

一个方便好用的 js 表达式解析器

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

expr-parser

简介

一个方便好用的 js 表达式解析器

安装

npm install --save expr-parser

使用

const Expression = require('expr-parser');

const exprCalc = new Expression('a.value + 12 - (2 * 14 / 4)').parse();

console.log(exprCalc({
    a: {
        value: 3 
    },
})); // 传入数据,输出计算结果 8

更多用法请参考测试用例

协议

MIT

About

一个方便好用的 js 表达式解析器

License:MIT License


Languages

Language:JavaScript 100.0%