UNPKG

@ivandt/json-rules

Version:

Rule parsing engine for JSON rules

15 lines (14 loc) 546 B
import { Rule } from "../types"; export declare class Evaluator { #private; /** * Evaluates a rule against a set of criteria and returns the result. * If the criteria is an array (indicating multiple criteria to test), * the rule will be evaluated against each item in the array and * an array of results will be returned. * * @param rule The rule to evaluate. * @param criteria The criteria to evaluate the rule against. */ evaluate<T>(rule: Rule, criteria: object | object[]): T | boolean; }