From 938d131afbb4a2f063797562cacef38971133859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=BE=D0=BB=D1=8F=20=D0=9D=D0=B0=D0=BB=D0=B1=D0=B0?= =?UTF-8?q?=D0=BD=D0=B4=D1=8F=D0=BD?= Date: Mon, 3 Dec 2018 18:15:36 +0200 Subject: [PATCH 1/2] Make compatible with IE8 --- src/rule.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rule.js b/src/rule.js index e0fc208..ba3467e 100644 --- a/src/rule.js +++ b/src/rule.js @@ -206,7 +206,8 @@ class Rule extends EventEmitter { } let orderedSets = this.prioritizeConditions(conditions) let cursor = Promise.resolve() - orderedSets.forEach((set) => { + for (let i = 0; i < orderedSets.length; i++) { + let set = orderedSets[i] let stop = false cursor = cursor.then((setResult) => { // after the first set succeeds, don't fire off the remaining promises @@ -225,7 +226,7 @@ class Rule extends EventEmitter { // all conditions passed; proceed with running next set in parallel return evaluateConditions(set, method) }) - }) + } return cursor } From c91581b495aef61f75ecc95cc6546151b83613bf Mon Sep 17 00:00:00 2001 From: Cache Hamm Date: Mon, 3 Dec 2018 09:28:14 -0700 Subject: [PATCH 2/2] Update rule.js Add comment explaining for() loop rational --- src/rule.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rule.js b/src/rule.js index ba3467e..a95d5c2 100644 --- a/src/rule.js +++ b/src/rule.js @@ -206,6 +206,7 @@ class Rule extends EventEmitter { } let orderedSets = this.prioritizeConditions(conditions) let cursor = Promise.resolve() + // use for() loop over Array.forEach to support IE8 without polyfill for (let i = 0; i < orderedSets.length; i++) { let set = orderedSets[i] let stop = false