@bpmn-io/费林
[注] 这是叉子 感觉
A 类 丹麦 用 JavaScript 编写的感觉解析器和解释器 . : arrow 右: 试试看。 。 。 .
使用量
import {
unaryTest,
evaluate
} from '@bpmn-io/feelin';
unaryTest('1', { '?': 1 }); // { value: true, warnings: [] }
unaryTest('[1..end]', { '?': 1, end: 10 }); // { value: true, warnings: [] }
evaluate("Mike's daughter.name", {
'Mike\'s daughter.name': 'Lisa'
}); // { value: 'Lisa', warnings: [] }
evaluate('for a in [1, 2, 3] return a * 2'); // { value: [ 2, 4, 6 ], ... }
evaluate('every rate in rates() satisfies rate < 10', {
rates() {
return [ 10, 20 ];
}
}); // { value: false, warnings: [] }
来理解 null 因出错而转换、检查 warnings 返回:
const { value, warnings } = evaluate('x');
console.log(warnings);
// [
// {
// message: "Variable 'x' not found",
// type: 'NO_VARIABLE_FOUND',
// position: { from: 0, to: 1 },
// }
// ]
特征
- 承认完全感觉的语法
- 上下文敏感( 包括空格名称)
- 错误恢复
- 时间类型和业务
- 内置感觉函数
- 满 DMN TCK 电话 遵守情况(参见:. 覆盖范围(中文(简体) )
构建和运行
# build the library and run all tests
npm run all
# spin up for local development
npm run dev
# execute FEEL tests in DMN TCK
npm run tck
相关
许可证
麻省理工学院