js深度工具deep-tls接口文档

2021-02-23  本文已影响0人  科研者

目录

内容

1. 相关文章

2. deepCopy()

详情请参数 深拷贝文档

3. createDeepCopy()

详情请参数 深拷贝文档

4. isDeepEqual()

function isDeepEqual(a: any, b: any, nullNotEqualUndefined?: boolean, strict?: boolean): boolean;

深度测试 a 和 b 是否完全相等;如果 a 和 b 是 对象,会进行递归相等测试,只有所有的属性 都相等时,才会认为是相等的;

注意:

5. DepthLoopPropertyCallback

type DepthLoopPropertyCallback<ThisVal> = (this: ThisVal, key: string, value: any, obj: any, currDepth: number) => any;

循环遍历的回调函数,简化的类型描述为 (key,value,obj,currDepth))=> stopInfo : any

6. DeepLoopOptions

interface DeepLoopOptions<ThisVal = any> {
    maxDepth?: number | null | undefined;
    thisValue?: ThisVal;
}

deepLoop的公共选项

7. DeepLoopOwnPropertyOptions

interface DeepLoopOwnPropertyOptions<ThisVal = any> extends DeepLoopOptions<ThisVal> {
    allOwnProps?: OptionalBoolean;
}

deepLoopOwnPropertyOptions的选项

8. deepLoopOwnProperty()

function deepLoopOwnProperty<Target extends object, ThisVal>(target: Target, callback: DepthLoopPropertyCallback<ThisVal extends undefined ? Target : ThisVal>, options?: DeepLoopOwnPropertyOptions<ThisVal> | null | undefined): any;

递归遍历自身属性链中的所有属性(不包含原型上的属性)

9. deepLoopPropertyWithPrototype()

function deepLoopPropertyWithPrototype<Target extends object, ThisVal>(target: Target, callback: DepthLoopPropertyCallback<ThisVal extends undefined ? Target : ThisVal>, options?: DeepLoopOptions<ThisVal> | null | undefined): any;

递归遍历自身包括原型的属性链中的所有可枚举的属性

上一篇 下一篇

猜你喜欢

热点阅读