Skip to content

Instantly share code, notes, and snippets.

@myhrvold
Created May 14, 2016 05:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myhrvold/43eab0c1e2e68d5538856975fdfbbd47 to your computer and use it in GitHub Desktop.
Save myhrvold/43eab0c1e2e68d5538856975fdfbbd47 to your computer and use it in GitHub Desktop.
First Example for Ride Policies Uber for Business article
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