/** * Ported from https://github.com/optimizely/client-js/blob/7f84e6e779288d8870cac9e17309bb4a324ec5c2/src/core/lib/condition.js * Minor modifications to remove existing logs and avoid use of client-fn * * Test ['and', 'or', 'not'] conditions * @module */ import { Condition, Conditions } from '../../models'; /** * Determine if conditions are satisfied. * * Ported from condition.compoundTest in js/client/condition.js * * @param {module:lib/condition~Conditions} conditions Conditions to apply. Evaluates recursively. * ```Grammar: conditions := [("and"|"or"),? (conditions)+] | ["not", conditions] | leaf * leaf := POJO``` * @param {evaluatorFn} evaluator * @return {Boolean|undefined} true/false if a result can be determined; undefined if no result can be determined * (because evaluator does not return a defined value for some required condition) * @throws {Error} Any error thrown by the evaluator at any point during the recursive evaluation. */ declare function evaluate(conditions: Conditions | Condition, evaluator: Function): any; /** * @param {*} conditions * ```Grammar: conditions := [("and"|"or"),? (conditions)+] | ["not", conditions] | leaf * leaf := POJO``` * @generator * @yields {Condition} * The leaf values in the given conditions tree. */ declare function getLeaves(conditions: Conditions | Condition): Generator; declare function allAudienceConditionsAreEdge(condition: Conditions): boolean; declare const _default: { allAudienceConditionsAreEdge: typeof allAudienceConditionsAreEdge; evaluate: typeof evaluate; getLeaves: typeof getLeaves; }; export default _default;