@diyaner/ding
Version:
dingiyan常用ts/js工具
138 lines (137 loc) • 3.51 kB
TypeScript
export declare enum enumTypes {
"string" = "string",
"number" = "number",
"array" = "array",
"object" = "object",
"function" = "function",
"date" = "date",
"boolean" = "boolean",
"Infinity" = "Infinity",
"-Infinity" = "-Infinity",
"NaN" = "NaN",
"null" = "null",
"undefined" = "undefined"
}
declare function is_type(val: any): string;
declare function is_type(val: any, target?: enumTypes): boolean;
/**
*instanceof 检查。
*
* @param {*} val 需检查的值。
* @param {Function} clzss 类
* @return {boolean} {boolean}
*/
declare function instanceofObject(val: any, clzss: Function): boolean;
/**
*是否字符串
*
* @param {*} val
* @return {*} {boolean}
*/
declare function is_string(val: any): boolean;
/**
*是否数值
*
* @param {*} num
* @return {*} {boolean}
*/
declare function is_number(num: any): boolean;
/**
*判断是否是NaN。非有效数值即为true.正常数值和正负无穷之外的均为true。
*与js内置isNaN不同,它将能Number转化的值,如'',true,false,[]等都视为false
*
* @param {*} num
* @return {*} {boolean}
*/
declare function is_NaN(num: any): boolean;
/**
*是否对象
*
* @param {*} val
* @return {*} {boolean}
*/
declare function is_object(val: any): boolean;
/**
*是否数组
*
* @param {*} val
* @return {*} {boolean}
*/
declare function is_array(val: any): boolean;
/**
*是否函数
*
* @param {*} val
* @return {*} {boolean}
*/
declare function is_function(val: any): boolean;
/**
*是否boolean
*
* @param {*} val
* @return {*} {boolean}
*/
declare function is_boolean(val: any): boolean;
/**
*是否日期。可判断字符串是否可转为日期对象,和是否是日期对象。
*
* @param {*} val
* @return {*} {boolean}
*/
declare function is_date(val: any): boolean;
/**
*判断是否null
*
* @param {*} val
* @return {*} {boolean}
*/
declare function is_null(val: any): boolean;
/**
*判断是否undefined
*
* @param {*} val
* @return {*} {boolean}
*/
declare function is_undefined(val: any): boolean;
/**
*判断是否为空。只判断string,array,object是否为空。
*
* @template T
* @param {(string | Array<T> | Object)} val
* @return {*} {boolean}
*/
declare function is_empty<T>(val: string | Array<T> | Object): boolean;
/**
*通常可用!!转为boolean。但is_false认为空数组和空对象均为false。返回true。
*
* @param {*} val
* @return {*}
*/
declare function is_false(val: any): boolean;
declare function is_class(fn: any): boolean;
declare function is_generator(obj: any): boolean;
declare function is_generator_function(obj: any): boolean;
declare function is_async_function(obj: any): boolean;
declare function is_promise(obj: any): boolean;
declare const _default: {
is_type: typeof is_type;
instanceofObject: typeof instanceofObject;
is_string: typeof is_string;
is_number: typeof is_number;
is_NaN: typeof is_NaN;
is_object: typeof is_object;
is_array: typeof is_array;
is_function: typeof is_function;
is_boolean: typeof is_boolean;
is_date: typeof is_date;
is_null: typeof is_null;
is_undefined: typeof is_undefined;
is_empty: typeof is_empty;
is_false: typeof is_false;
is_class: typeof is_class;
is_async_function: typeof is_async_function;
is_generator: typeof is_generator;
is_generator_function: typeof is_generator_function;
is_promise: typeof is_promise;
};
export default _default;