anandrajneesh / decision-engine

Nodejs Rule Engine
https://anandrajneesh.github.io/decision-engine/
MIT License
12 stars 4 forks source link

engine is exported as function instead of object #9

Closed anandrajneesh closed 7 years ago

anandrajneesh commented 7 years ago

According to docs to use engine below code has to be used and then functions can be invoked on the returned object.

const decisionEngine = require('decision-engine')
decisionEngine.addRule(require('./orderSystem/discount.json'))

However the decisionEngine is a function instead of object. Functions like addRule and importRules are not available, rather it is required to invoke decisionEngine as a function and then the returned object has the aforementioned functions. Either docs should mention this or exports should be fixed.

anandrajneesh commented 7 years ago

exports should be fixed !

anandrajneesh commented 7 years ago

Oddly enough test cases were already invoking decisionEngine as function and then using the returned object.

anandrajneesh commented 7 years ago

Fixed in v1.1.4