@berish/validate
Version:
Validation of complex objects with support for validation maps, rules and decorators
8 lines (7 loc) • 559 B
TypeScript
import { IRuleObject, IRuleObjectBody, IRuleErrorTextResult, IValidateRule } from './types';
export interface ICreateSimpleRuleParams<Body extends any[]> {
name?: string;
conditionSync?: (obj: IRuleObject & IRuleObjectBody<Body>) => boolean | IRuleErrorTextResult | void;
conditionAsync?: (obj: IRuleObject & IRuleObjectBody<Body>) => boolean | IRuleErrorTextResult | void | Promise<boolean | IRuleErrorTextResult | void>;
}
export declare function createSimpleRule<Body extends any[]>(params: ICreateSimpleRuleParams<Body>): IValidateRule<Body>;