AEP 规则引擎
概览
TypeScript中一个简单,通用,可扩展的规则引擎.
安装
虽然写入了TypeScript,但该构建生成了JavaScript执行,可以在任何地方使用JavaScript都可以被评价.
通过 npm 安装.
npm install @adobe/aep-rules-engine
使用量
const RulesEngine = require("@adobe/aep-rules-engine");
const ruleset = RulesEngine({
version: 1,
rules: [
{
condition: {
definition: {
conditions: [
{
definition: {
conditions: [
{
definition: {
key: "color",
matcher: "eq",
values: ["orange", "blue"],
},
type: "matcher",
},
],
logic: "and",
},
type: "group",
},
],
logic: "and",
},
type: "group",
},
consequences: [
{
type: "item",
detail: {
hello: "world",
},
id: "abc123",
},
],
},
],
});
const consequences = ruleset.execute({ color: "orange" });
捐款
欢迎捐款! 读取 贡献指南 更多信息.
许可证发放
这个项目根据Apache V2许可证获得许可. 见 自由主义 更多信息.