Json: {
    cloneDeep(obj: any): any;
    deleteDeepByKey(object: any, substring: any): any;
    findInArray(objs: any[], predicate: any): any;
    get(obj: any, path: string[], defaultValue?: any): any;
    getPaths(o: any, prefix?: string, delim?: string): string[];
    isEqualJson(obj1: object, obj2: object, ignoreKeys?: string[]): boolean;
    mergeDeep(obj1: any, obj2: any): any;
    put(obj: any, value: any, path: string[]): any;
    stringify(obj: any): string;
}

Type declaration

  • cloneDeep:function
    • Deep clone object

      Parameters

      • obj: any

        object to deep clone

      Returns any

      new object cloned from obj

  • deleteDeepByKey:function
    • Deep delete keys and their values from an input object. If a key in object contains substring, the key an its value is deleted.

      Parameters

      • object: any

        input object that needs keys removed

      • substring: any

        substring to search for in key

      Returns any

      the modified object without the matching keys and their values

  • findInArray:function
    • Parameters

      • objs: any[]
      • predicate: any

      Returns any

  • get:function
    • Parameters

      • obj: any
      • path: string[]
      • Optional defaultValue: any

      Returns any

  • getPaths:function
    • Get all paths for an object

      Parameters

      • o: any

        object

      • Optional prefix: string

        prefix (path calculated up to this point). Only needed for recursion or to add a global prefix to all paths.

      • Optional delim: string

        delimiter used to separate elements of the path. Default is '.'.

      Returns string[]

      an array of paths

  • isEqualJson:function
    • Compare two json objects

      Parameters

      • obj1: object

        object 1

      • obj2: object

        object 2

      • Optional ignoreKeys: string[]

        array of keys to ignore in comparison

      Returns boolean

      true if the two json objects have the same length and all the properties have the same value

  • mergeDeep:function
    • Deep merge two objects

      Parameters

      • obj1: any

        first object

      • obj2: any

        second object

      Returns any

      merged first and second object

  • put:function
    • Parameters

      • obj: any
      • value: any
      • path: string[]

      Returns any

  • stringify:function
    • Deterministic stringify

      Parameters

      • obj: any

        json object to stringify deterministically

      Returns string

      stringified json object