UNPKG

konditions

Version:

A simple and customizable JSON-based condition engine in TypeScript (e.g. GreaterThan, StringLike, Every, Some)

15 lines (14 loc) 570 B
import { ConditionResolver, ConditionValidator, Engine, InputProps } from "../model"; import { AnyResolution } from "./resolution"; export declare type EngineRegistry<P = any, E = any, O = any> = { [key: string]: { resolver: ConditionResolver<O, P>; validator: ConditionValidator<P, E, O>; }; }; export declare class DefaultEngine<R extends EngineRegistry> implements Engine<AnyResolution> { private commands; constructor(commands: R); evaluate(props: InputProps): Promise<AnyResolution>; get<T extends keyof R>(type: T): R[T]; }