Skip to content

Commit

Permalink
Upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Cache Hamm committed Dec 29, 2018
1 parent feeef17 commit 2938db3
Show file tree
Hide file tree
Showing 29 changed files with 4,094 additions and 8,506 deletions.
2 changes: 1 addition & 1 deletion examples/02-nested-boolean-logic.js
Expand Up @@ -44,7 +44,7 @@ engine.addRule({
}]
}]
},
event: { // define the event to fire when the conditions evaluate truthy
event: { // define the event to fire when the conditions evaluate truthy
type: 'fouledOut',
params: {
message: 'Player has fouled out!'
Expand Down
2 changes: 1 addition & 1 deletion examples/04-fact-dependency.js
Expand Up @@ -110,7 +110,7 @@ engine.addFact('employee-tenure', (params, almanac) => {
// define fact(s) known at runtime
facts = { accountId: 'washington' }
engine
.run(facts) // first run, using washington's facts
.run(facts) // first run, using washington's facts
.then(() => {
facts = { accountId: 'jefferson' }
return engine.run(facts) // second run, using jefferson's facts; facts & evaluation are independent of the first run
Expand Down
6 changes: 3 additions & 3 deletions examples/05-optimizing-runtime-with-fact-priorities.js
Expand Up @@ -67,9 +67,9 @@ engine.addFact('account-information', (params, almanac) => {
// this fact will not be evaluated, because the "date" fact will fail first
console.log('Checking the "account-information" fact...') // this message will not appear
return almanac.factValue('accountId')
.then((accountId) => {
return accountClient.getAccountInformation(accountId)
})
.then((accountId) => {
return accountClient.getAccountInformation(accountId)
})
}, { priority: LOW })

/**
Expand Down
2 changes: 1 addition & 1 deletion examples/06-custom-operators.js
Expand Up @@ -91,7 +91,7 @@ facts = {
word: 'bacon'
}
engine
.run(facts) // first run, using 'bacon'
.run(facts) // first run, using 'bacon'
.then(() => {
facts = {
word: 'antelope'
Expand Down
2 changes: 1 addition & 1 deletion examples/07-rule-chaining.js
Expand Up @@ -82,7 +82,7 @@ engine
// define fact(s) known at runtime
facts = { accountId: 'washington', drinksOrangeJuice: true, enjoysVodka: true, isSociable: true }
engine
.run(facts) // first run, using washington's facts
.run(facts) // first run, using washington's facts
.then(() => {
facts = { accountId: 'jefferson', drinksOrangeJuice: true, enjoysVodka: false, isSociable: true }
return engine.run(facts) // second run, using jefferson's facts; facts & evaluation are independent of the first run
Expand Down
4 changes: 2 additions & 2 deletions examples/08-fact-comparison.js
Expand Up @@ -33,7 +33,7 @@ let rule = {
accountType: 'customer'
},

operator: 'greaterThanInclusive', // >=
operator: 'greaterThanInclusive', // >=

// "value" in this instance is an object containing a fact definition
// fact helpers "path" and "params" are supported here as well
Expand Down Expand Up @@ -115,7 +115,7 @@ let userFacts = {
facts = Object.assign({}, userFacts, productList)

engine
.run(facts) // first run, user can afford a gift card
.run(facts) // first run, user can afford a gift card
.then(() => {
// second run; a user that cannot afford a gift card
userFacts = {
Expand Down
18 changes: 9 additions & 9 deletions examples/09-rule-results.js
Expand Up @@ -30,7 +30,7 @@ engine.addRule({
value: 3.5
}]
},
event: { // define the event to fire when the conditions evaluate truthy
event: { // define the event to fire when the conditions evaluate truthy
type: 'honor-roll',
params: {
message: 'Student made the athletics honor-roll'
Expand All @@ -45,14 +45,14 @@ function render (message, ruleResult) {
}
// if rule failed, iterate over each failed condition to determine why the student didn't qualify for athletics honor roll
let detail = ruleResult.conditions.all.filter(condition => !condition.result)
.map(condition => {
switch (condition.operator) {
case 'equal':
return `was not an ${condition.fact}`
case 'greaterThanInclusive':
return `${condition.fact} of ${condition.factResult} was too low`
}
}).join(' and ')
.map(condition => {
switch (condition.operator) {
case 'equal':
return `was not an ${condition.fact}`
case 'greaterThanInclusive':
return `${condition.fact} of ${condition.factResult} was too low`
}
}).join(' and ')
console.log(`${message} ${detail}`.red)
}

Expand Down

0 comments on commit 2938db3

Please sign in to comment.