@berish/validate
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -8,4 +8,4 @@ import { IValidateRule, IRuleObject, IRuleObjectBody, IRuleObjectFlag, IRuleErrorTextResult } from './types'; | ||
conditionAsync?: (obj: IRuleObject & IRuleObjectBody<Body>) => boolean | IRuleFlag | Promise<boolean | IRuleFlag>; | ||
errorText?: (obj: IRuleObject & IRuleObjectBody<Body> & IRuleObjectFlag) => IRuleErrorTextResult | typeof SYMBOL_ERROR_TEXT_DEFAULT; | ||
errorText?: (obj: IRuleObject & IRuleObjectBody<Body> & IRuleObjectFlag) => IRuleErrorTextResult | typeof SYMBOL_ERROR_TEXT_DEFAULT | void; | ||
} | ||
export declare function createRule<Body extends any[]>(params: ICreateRuleParams<Body>): IValidateRule<Body>; |
@@ -91,5 +91,3 @@ "use strict"; | ||
return defaultErrorText; | ||
const result = params.errorText(Object.assign(Object.assign({}, obj), { body })); | ||
if (!result) | ||
return defaultErrorText; | ||
const result = params.errorText(Object.assign(Object.assign({}, obj), { body })) || exports.SYMBOL_ERROR_TEXT_DEFAULT; | ||
if (result === exports.SYMBOL_ERROR_TEXT_DEFAULT) | ||
@@ -96,0 +94,0 @@ return defaultErrorText; |
import { IRuleObject, IRuleObjectBody, IRuleErrorTextResult, IValidateRule } from './types'; | ||
export interface ICreateSimpleRuleParams<Body extends any[]> { | ||
name?: string; | ||
conditionSync?: (obj: IRuleObject & IRuleObjectBody<Body>) => boolean | IRuleErrorTextResult; | ||
conditionAsync?: (obj: IRuleObject & IRuleObjectBody<Body>) => boolean | IRuleErrorTextResult | Promise<boolean | IRuleErrorTextResult>; | ||
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>; |
{ | ||
"name": "@berish/validate", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "Validation of complex objects with support for validation maps, rules and decorators", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
Sorry, the diff of this file is not supported yet
80695
982