Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 17287a9ba3 | |||
| 11921a2864 | |||
| 9035fafdc2 | |||
| 773ae00517 |
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartrule",
|
"name": "@pushrocks/smartrule",
|
||||||
"version": "1.0.7",
|
"version": "1.0.9",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartrule",
|
"name": "@pushrocks/smartrule",
|
||||||
"version": "1.0.7",
|
"version": "1.0.9",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "a smart rule library for handling decision trees.",
|
"description": "a smart rule library for handling decision trees.",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
|||||||
@@ -32,8 +32,10 @@ export class SmartRule<T> {
|
|||||||
const outcomes: TTreeActionResult[] = [];
|
const outcomes: TTreeActionResult[] = [];
|
||||||
for (const rule of nextBatch) {
|
for (const rule of nextBatch) {
|
||||||
const checkResult = await rule.checkFunction(objectArg);
|
const checkResult = await rule.checkFunction(objectArg);
|
||||||
|
checkResult ? null : console.log('WARNING!!! Please make sure your rule always returns a statement of how to continue!');
|
||||||
|
|
||||||
if (checkResult.startsWith("apply")) {
|
if (checkResult.startsWith("apply")) {
|
||||||
await rule.actionFunction(objectArg);
|
await rule.actionFunction(objectArg); // here the action function is run
|
||||||
}
|
}
|
||||||
outcomes.push(checkResult);
|
outcomes.push(checkResult);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user