Skip to content

Instantly share code, notes, and snippets.

View jxub's full-sized avatar
🏯

Jakub Janarek jxub

🏯
View GitHub Profile
@jxub
jxub / node-rules.d.ts
Created March 3, 2020 14:44
Simple typings for the node-rules package (https://github.com/mithunsatheesh/node-rules)
declare module 'node-rules' {
export default class RuleEngine {
constructor(rules?: Rule[] | Rule, options?: object);
register(rule: Rule): any;
sync(): Rule[] | void;
execute(fact: {[x: string]: any}, cb: (data: {result?: any, reason?: any, [x: string]: any}) => void): void;
findRules(filter?: any): Rule[] | void;
turn(state: string, filter: any): Rule[] | void;
prioritize(priority: number, filter: any): Rule[] | void;
toJSON(): string;