node-web-mvc
Version:
node spring mvc
55 lines (54 loc) • 1.64 kB
TypeScript
/**
* @module Assert
* @description 断言工具集
*/
export default class Assert {
/**
* 断言:value必须为指定类型
* @param value 值
* @param ctor 类型
*/
static isType(value: any, ctor: any, message?: string): void;
/**
* 断言:传入参数需要为:null或者undefined
*/
static isNull(value: any, message?: string): void;
/**
* 断言:传入参数应该不为:null或者undefined
*/
static notNull(value: any, message?: string): void;
/**
* 断言:传入参数需要为:null或者undefined或者空字符串,或者空数组(length === 0)
*/
static isEmpty(value: any, message?: string): void;
/**
* 断言:传入参数应该不为:null或者undefined或者空字符串或者空数组(length === 0)
*/
static notEmpty(value: any, message?: string): void;
/**
* 断言:需要包含指定字符串
* @param value
* @param include
* @param message
*/
static doesContain(value: string, include: string, message?: string): void;
/**
* 断言: 不能包含指定字符串
* @param value
* @param include
* @param message
*/
static doesNotContain(value: string, include: string, message?: string): void;
/**
* 断言: 数组项中不能存在空项(null,undefined)
* @param value
* @param message
*/
static noNullElements(value: Array<any>, message?: string): void;
/**
* 断言:value 必须为type的实例
* @param value
* @param type
*/
static isInstanceOf(value: any, type: any, message?: string): void;
}