@brainstack/rules-engine
Version:
A lightweight rules engine to evaluate conditional logic.
21 lines (20 loc) • 699 B
TypeScript
import { IRule } from "./abstraction";
/**
* A rules engine class that evaluates a set of rules against provided data.
*/
export declare class RulesEngine {
private rules;
/**
* Constructs a new instance of the RulesEngine.
*
* @param rules - An array of `IRule` objects that the engine will use for evaluation.
*/
constructor(rules: IRule[]);
/**
* Evaluates the set of rules against the provided data.
*
* @param data - The data to evaluate against the rules. This can be any type of data structure.
* @returns A string array containing the names of the rules returning true during evaluation.
*/
evaluate(data: any): string[];
}