UNPKG

ts-prime

Version:

A utility library for JavaScript and Typescript.

31 lines 1.05 kB
/** * Compares two values recursively. * @warning Soft mode is relative expensive operation. * @description * The function has two modes `soft` and `hard` soft mode ignores array order hard mode preserves array order * - `Soft mode` ignore array order. * @param valueA - anything * @param valueB - anything * @example * P.deepEquals({ * data: 1, * super: [{ id: 1, name: "Tom" }, { id: 2, name: "Martin" }] * }, { * data: 1, * super: [{ id: 2, name: "Martin" }, { id: 1, name: "Tom" }] * }) // false super property is not equal * * P.deepEquals({ * data: 1, * super: [{ id: 1, name: "Tom" }, { id: 2, name: "Martin" }] * }, { * data: 1, * super: [{ id: 2, name: "Martin" }, { id: 1, name: "Tom" }] * }, 'soft') // true Ignores array order * * * @param mode - array comparison mode * @category Utility */ export declare function deepEqual(valueA: unknown, valueB: unknown, mode?: 'soft' | 'hard'): boolean; //# sourceMappingURL=deepEqual.d.ts.map