2 Commits

Author SHA1 Message Date
8c257bc0fd 1.0.5 2020-01-23 15:11:30 +00:00
a4ff5c26e2 fix(core): update 2020-01-23 15:11:29 +00:00
3 changed files with 13 additions and 11 deletions

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartrule", "name": "@pushrocks/smartrule",
"version": "1.0.4", "version": "1.0.5",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartrule", "name": "@pushrocks/smartrule",
"version": "1.0.4", "version": "1.0.5",
"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",

View File

@@ -35,18 +35,20 @@ export class SmartRule<T> {
await rule.actionFunction(objectArg); await rule.actionFunction(objectArg);
} }
outcomes.push(checkResult); outcomes.push(checkResult);
}; }
const finalOutcome: TTreeActionResult = outcomes.reduce((previous, current, index, array) => { if (outcomes.length > 0) {
const finalOutcomeOfBatch: TTreeActionResult = outcomes.reduce((previous, current, index, array) => {
if (current.includes('continue') || previous.includes('continue')) { if (current.includes('continue') || previous.includes('continue')) {
return 'continue'; return 'continue';
} else { } else {
return 'stop'; return 'stop';
} }
}); });
if (finalOutcome === 'stop') { if (finalOutcomeOfBatch === 'stop') {
return; return;
} }
}
if (startPriority < this.rules[this.rules.length-1].priority) { if (startPriority < this.rules[this.rules.length-1].priority) {
runNextBatch(startPriority++); runNextBatch(startPriority++);