UNPKG

ds-tool

Version:
79 lines (78 loc) 2.38 kB
/** * 对象的深度克隆 */ export declare const deepCloneObj: (origin: DS_T.IDobj, target?: any) => any; /** * 判断是否是非0的假值 */ export declare const isNzFalse: (value: any) => boolean; /** * 判断是否是有效的数据,包括0 */ export declare const isEfVal: (value: any) => boolean; /** * 获取排除假值的数据,如果该值为假则返回空字符串 * eRes 当value为假时,期望得到的结果 */ export declare const getEEvalue: (value: any, eRes?: any) => any; /** * 获取字符串的字节长度 正则版本 * @param {String} s * @returns */ export declare const regGetByteOfStr: (s?: string) => number; /** * 生成uuid * @param key * @param {Number} size 最大缓存数量 * @returns */ export declare const createUuid: (key?: string, size?: number) => string; /** * 获取指定时区的日期对象 * @param t 时区默认东8区 * @returns */ export declare const getDateOfTimezone: (t?: number) => any; /** * 延迟函数 * @param num 毫秒 * @returns */ export declare const dsDelayTime: (num?: number) => Promise<unknown>; /** * 缓存api数据, 每次缓存时间默认为一分钟 fn必须为async函数 * @param key */ export declare const dsGetCacheData: (key: string, fn: any, expireTime?: number, loop?: number) => Promise<any>; /** * 清除api缓存数据 * @param key */ export declare const dsClearCacheData: (key?: string | undefined) => Promise<void>; /** * 防抖函数 : 一个需要频繁触发的函数,无论触发多少次,只执行最后一次(input事件) * @param fn * @param delay (毫秒) * @returns */ export declare const dsDebounce: (fn: any, delay?: number) => (...arg: any[]) => void; export declare const dsReduceDealWith: (fn: any, delay?: number, mastExec?: number) => (...arg: any[]) => void; /** * 数组去重 * @param tagArr * @returns */ export declare const dsArrReduction: (tagArr: any[], key?: string | undefined) => { newArrr: any[]; temp: {}; loopNum: number; }; /** * 清除对象中的空数据 */ export declare const dsDeleteObjEmptyKey: (obj?: DS_T.IDobj) => {} | null; /** * 把JSON数据转换为串行字符串, 返回值:串行字符串 */ export declare const dsJSONtoString: (data: object, symb?: string) => string;