UNPKG

fair-wing

Version:

Dome for easy project operation

55 lines (48 loc) 2.22 kB
type IObject = { [key: string]: any; [key: number]: any; }; /** * @description: 数据类型精准判断 * @param {*} keyVal 要判断的数据 * @return {*} 类型名称的字符串(小写): number、string、boolean、null、undefined、object、symbol... */ declare function typeOf(keyVal: any): string; declare function S4(): symbol; declare function getUUID(prefix?: string): string; declare function cloneDeep(value: any): never; /** * @description: 也为深拷贝,数组的额外值也能被拷贝,列:[1, ids: Symbol(13359)],可以拷贝出数组中的Symbol * @param {*} obj 需要进行拷贝的数据 * @return {*} 深拷贝完成后的数据 */ declare function deepCopy(obj: any): any; type fnType$1 = (item: IObject, key: any, parent: IObject | null, level: number) => void; /** * @description: 像遍历数组一样遍历集合对象,遍历集合对象(像es6的forEach一样不能停止) * @param {*} obj 查找的源对象 * @param {*} fn(value,key,parent,level):回调函数;value: 遍历到的当前value值,key: 遍历到的当前key,parent: 遍历到的当前对象,level: 遍历源对象的当前层级,开始为0 * @return {*} 经过操作后的obj对象 */ declare function forEach(obj: IObject, fn: fnType$1): IObject; declare const findOwn: (obj: IObject, second: any, third?: number | string, fourth?: number) => any; declare const findParent: (obj: IObject, second: any, third?: number | string, fourth?: number) => any; declare const findParents: (obj: IObject, second: any, third?: number | string, fourth?: number) => any; declare const find: (obj: IObject, second: any, third?: number | string, fourth?: number) => any; type assignType = { (...param: any[]): void; empty: Symbol; end: Symbol; delete: Symbol; }; declare const assign: assignType; type fnType = (arg0: ({ status: ('before' | 'after'); value: any; key: any; parent: any; level: number; parents: any[]; }), arg1: Symbol, arg2: Symbol) => (symbol | any); declare function mapFilter(obj: IObject, fn: fnType): any; export { S4, assign, cloneDeep, deepCopy, find, findOwn, findParent, findParents, forEach, getUUID, mapFilter, typeOf };