Created
May 14, 2016 05:25
-
-
Save myhrvold/43eab0c1e2e68d5538856975fdfbbd47 to your computer and use it in GitHub Desktop.
First Example for Ride Policies Uber for Business article
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var esprima = require('esprima'); | |
var evaluate = require('static-eval'); | |
module.exports = function evaluateRule(rule, fact) { | |
var ruleAST = esprima.parse(rule); | |
return evaluate(ruleAST.body[0].expression, fact); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment