json-rules-engine
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -0,1 +1,4 @@ | ||
2.0.3 / 2018-01-29 | ||
* Add factResult and result to the JSON generated for Condition (@bjacobso) | ||
2.0.2 / 2017-07-24 | ||
@@ -2,0 +5,0 @@ * Bugfix IE8 support |
@@ -72,2 +72,8 @@ 'use strict'; | ||
props.fact = this.fact; | ||
if (this.factResult !== undefined) { | ||
props.factResult = this.factResult; | ||
} | ||
if (this.result !== undefined) { | ||
props.result = this.result; | ||
} | ||
if (this.params) { | ||
@@ -74,0 +80,0 @@ props.params = this.params; |
@@ -193,6 +193,2 @@ /** | ||
if (typeof global.process === "object" && global.process.domain) { | ||
invoke = global.process.domain.bind(invoke); | ||
} | ||
var previousPromise; | ||
@@ -731,8 +727,6 @@ | ||
})( | ||
// Among the various tricks for obtaining a reference to the global | ||
// object, this seems to be the most reliable technique that does not | ||
// use indirect eval (which violates Content Security Policy). | ||
typeof global === "object" ? global : | ||
typeof window === "object" ? window : | ||
typeof self === "object" ? self : this | ||
// In sloppy mode, unbound `this` refers to the global object, fallback to | ||
// Function constructor if we're in global strict mode. That is sadly a form | ||
// of indirect eval which violates Content Security Policy. | ||
(function() { return this })() || Function("return this")() | ||
); |
@@ -189,5 +189,5 @@ | ||
fact: 'product-price', | ||
path: '.price', | ||
params: { | ||
productId: 'widget', | ||
path: '.price' | ||
productId: 'widget' | ||
}, | ||
@@ -194,0 +194,0 @@ operator: 'greaterThan', |
{ | ||
"name": "json-rules-engine", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Rules Engine expressed in simple json", | ||
@@ -47,29 +47,29 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"babel-cli": "^6.4.5", | ||
"babel-core": "~6.24.1", | ||
"babel-eslint": "^7.1.1", | ||
"babel-loader": "~6.4.1", | ||
"babel-cli": "6.26.0", | ||
"babel-core": "6.26.0", | ||
"babel-eslint": "8.0.2", | ||
"babel-loader": "7.1.2", | ||
"babel-plugin-transform-async-to-generator": "^6.4.6", | ||
"babel-polyfill": "~6.23.0", | ||
"babel-polyfill": "6.26.0", | ||
"babel-preset-es2015": "~6.24.1", | ||
"babel-preset-stage-0": "~6.24.1", | ||
"babel-register": "^6.4.3", | ||
"chai": "^3.5.0", | ||
"chai-as-promised": "^6.0.0", | ||
"babel-register": "6.26.0", | ||
"chai": "4.1.2", | ||
"chai-as-promised": "7.1.1", | ||
"colors": "~1.1.2", | ||
"dirty-chai": "1.2.2", | ||
"mocha": "^3.2.0", | ||
"regenerator": "~0.9.7", | ||
"sinon": "^2.1.0", | ||
"sinon-chai": "^2.8.0", | ||
"dirty-chai": "2.0.1", | ||
"mocha": "4.0.1", | ||
"regenerator": "0.11.0", | ||
"sinon": "4.1.2", | ||
"sinon-chai": "2.14.0", | ||
"snazzy": "^7.0.0", | ||
"standard": "^10.0.1" | ||
"standard": "10.0.3" | ||
}, | ||
"dependencies": { | ||
"clone": "^2.1.1", | ||
"debug": "~2.6.3", | ||
"lodash.isobjectlike": "~4.0.0", | ||
"object-hash": "~1.1.8", | ||
"selectn": "~1.1.2" | ||
"debug": "^3.1.0", | ||
"lodash.isobjectlike": "^4.0.0", | ||
"object-hash": "^1.2.0", | ||
"selectn": "^1.1.2" | ||
} | ||
} |
@@ -54,3 +54,3 @@ import { Fact } from '../src/index' | ||
it('throws an exception if it encounters an undefined fact', () => { | ||
expect(almanac.factValue('foo')).to.be.rejectedWith(/Undefined fact: foo/) | ||
return expect(almanac.factValue('bar')).to.eventually.be.rejectedWith(/Undefined fact: bar/) | ||
}) | ||
@@ -57,0 +57,0 @@ }) |
@@ -308,3 +308,3 @@ 'use strict' | ||
let ruleResult = successSpy.getCall(0).args[2] | ||
let expected = '{"conditions":{"priority":1,"any":[{"operator":"greaterThanInclusive","value":21,"fact":"age"},{"operator":"equal","value":true,"fact":"qualified"}]},"event":{"type":"setDrinkingFlag","params":{"canOrderDrinks":true}},"priority":100,"result":true}' | ||
let expected = '{"conditions":{"priority":1,"any":[{"operator":"greaterThanInclusive","value":21,"fact":"age","factResult":21,"result":true},{"operator":"equal","value":true,"fact":"qualified","factResult":false,"result":false}]},"event":{"type":"setDrinkingFlag","params":{"canOrderDrinks":true}},"priority":100,"result":true}' | ||
expect(JSON.stringify(ruleResult)).to.equal(expected) | ||
@@ -311,0 +311,0 @@ }) |
@@ -61,5 +61,5 @@ 'use strict' | ||
let engine = setup() | ||
expect(engine.run()).to.eventually.throw('Unknown operator: unknown-operator') | ||
return expect(engine.run()).to.eventually.be.rejectedWith('Unknown operator: unknown-operator') | ||
}) | ||
}) | ||
}) |
@@ -62,3 +62,3 @@ 'use strict' | ||
expect(results.length).to.equal(1) | ||
expect(results).to.include(rule.event) | ||
expect(results).to.deep.include(rule.event) | ||
}) | ||
@@ -70,4 +70,4 @@ }) | ||
expect(results.length).to.equal(2) | ||
expect(results).to.include(rule.event) | ||
expect(results).to.include(rule2.event) | ||
expect(results).to.deep.include(rule.event) | ||
expect(results).to.deep.include(rule2.event) | ||
}) | ||
@@ -74,0 +74,0 @@ }) |
Sorry, the diff of this file is not supported yet
238208
5459
64
+ Addeddebug@3.2.7(transitive)
+ Addedms@2.1.3(transitive)
+ Addedobject-hash@1.3.1(transitive)
- Removedobject-hash@1.1.8(transitive)
Updateddebug@^3.1.0
Updatedlodash.isobjectlike@^4.0.0
Updatedobject-hash@^1.2.0
Updatedselectn@^1.1.2