src/predicates.js
/**
Evaluates a query against a user object and saves passing/failing rule ids to provided sets.

  @param context A context object containing describing the context the predicate should be evaluated against.
  @param predicate Nested predicate object that rules structured into groups as a deeply nested tree.
               note: There is no set limit to the depth of this tree, hence we must work with it
               using recursion.
*/
Evaluates a query against a user object and saves passing/failing rule ids to provided sets.
@param context A context object containing describing the context the predicate should be evaluated against.
@param predicate Nested predicate object that rules structured into groups as a deeply nested tree.
note: There is no set limit to the depth of this tree, hence we must work with it
using recursion.
Evaluates a query against a user object and saves passing / failing rule ids to provided sets . @param context A context object containing describing the context the predicate should be evaluated against . @param predicate Nested predicate object that rules structured into groups as a deeply nested tree . note : There is no set limit to the depth of this tree hence we must work with it using recursion .
function evaluate(context, predicate) {
  const result = {
    passed: new Set(),
    failed: new Set()
  };
  result.rejected = !evaluatePredicate(context, predicate, result.passed, result.failed);
  return result;
}
function evaluate ( context , predicate ) { const result = { passed : new Set ( ) , failed : new Set ( ) } ; result . rejected = ! evaluatePredicate ( context , predicate , result . passed , result . failed ) ; return result ; }
Evaluates a query against a user object and saves passing/failing rule ids to provided sets.
Evaluates a query against a user object and saves passing / failing rule ids to provided sets .