simple-body-validator
Version:
This package is inspired by Laravel validation, and aims to make body validation easier for Javascript developers
35 lines (34 loc) • 859 B
TypeScript
export default class RuleContract {
/**
* The validation error message.
*/
message: string | object;
/**
* All of the data under validation.
*/
data: object;
/**
* The lang used to return error messages
*/
lang: string;
/**
* Determine if the validation rule passes.
*/
passes(value: any, attribute: string): boolean | Promise<boolean>;
/**
* Get the validation error message.
*/
getMessage(): string | object;
/**
* Set the data under validation.
*/
setData(data: object): RuleContract;
/**
* Set the tranlation language
*/
setLang(lang: string): RuleContract;
/**
* Get the translated error message based on the specified path
*/
trans(path: string, params?: object): string;
}