Files
recap/node_modules/@start9labs/start-sdk/base/lib/util/deepMerge.d.ts
T

23 lines
976 B
TypeScript

/**
* Computes the partial difference between two values.
* Returns `undefined` if the values are equal, or `{ diff }` containing only the changed parts.
* For arrays, the diff contains only items in `next` that have no deep-equal counterpart in `prev`.
* For objects, the diff contains only keys whose values changed.
*
* @param prev - The original value
* @param next - The updated value
* @returns An object containing the diff, or `undefined` if the values are equal
*/
export declare function partialDiff<T>(prev: T, next: T): {
diff: Partial<T>;
} | undefined;
/**
* Deeply merges multiple values together. Objects are merged key-by-key recursively.
* Arrays are merged by appending items that are not already present (by deep equality).
* Primitives are resolved by taking the last argument.
*
* @param args - The values to merge, applied left to right
* @returns The merged result
*/
export declare function deepMerge(...args: unknown[]): unknown;