lin-cms-test
Version:
The core library of Lin CMS, this package is just for test!
38 lines (37 loc) • 836 B
TypeScript
import { Context } from "koa";
/**
* 支持optional,支持array,支持nested object
*/
export declare class ClassValidator {
/**
* 装载数据的容器
*/
data: any;
/**
* 解析后的数据容器
*/
parsed: any;
/**
* 数据校验错误容器
*/
errors: any[];
/**
* 别名
*/
alias: any;
validate(ctx: Context, alias?: {}): Promise<this>;
private replace;
private checkRules;
get(path: string, parsed?: boolean): any;
}
export declare class Rule {
options: any;
message: string;
validateFunction: string | Function;
optional: boolean;
parsedValue: any;
rawValue: any;
defaultValue: any;
constructor(validateFunction: string | Function, message?: string, ...options: any[]);
validate(value: any): any;
}