UNPKG

@o3r/rules-engine

Version:

This module provides a rule engine that can be executed on your Otter application to customize your application (translations, placeholders and configs) based on a json file generated by your CMS.

51 lines 2 kB
import type { Facts } from '../fact'; import { DateInput, Operator, SupportedSimpleTypes } from './operator.interface'; /** * Execute Operator * @param lhs Left hand side * @param rhs Right hand side * @param operator Operator to compare values * @param operatorFacts Facts that operator can depend on */ export declare function executeOperator<L = unknown, R = unknown>(lhs: L, rhs: R, operator: Operator<L, R>, operatorFacts?: Record<string, Facts | undefined>): boolean; /** * Validate a number operand * @param operand value of one of the operands */ export declare function numberValidator(operand: unknown): operand is number | string; /** * Validate an operand is a range of numbers * @param operatorInput value of one of the operands */ export declare function isRangeNumber(operatorInput: unknown): operatorInput is [number | string, number | string]; /** * Verifies if the parameter is a valid date for the operator (getTime function available returning a number) * @param operatorInput */ export declare const isValidDate: (operatorInput: any) => operatorInput is Date; /** * Verifies if the parameter is a valid input for Date constructor (new Date returns a valid date) * @param operatorInput */ export declare const isValidDateInput: (operatorInput: any) => operatorInput is DateInput; /** * Verifies if the parameter is a valid date range * @param operatorInput */ export declare const isValidDateRange: (operatorInput: any) => operatorInput is [DateInput, DateInput]; /** * Validate that a value is a supported simple type * @param value value to validate */ export declare function isSupportedSimpleTypes(value: unknown): value is SupportedSimpleTypes; /** * Validate that a value is a string * @param value */ export declare function isString(value: unknown): value is string; /** * Parse input to return RegExp * @param inputRegExp */ export declare function parseRegExp(inputRegExp: string): RegExp; //# sourceMappingURL=operator.helpers.d.ts.map