merge-change
Version:
Advanced library for deep merging, patching, and immutable updates of data structures. Features declarative operations for specific merging behaviors, property management, custom type merging rules, and difference tracking. Supports complex data transform
15 lines (14 loc) • 830 B
TypeScript
import { DiffOptions, DiffResult } from './types';
/**
* Calculates the difference, the result is an object with $set and $unset operators
* @param source {*} Source value
* @param compare {*} Compared (new) value
* @param [ignore] {Array<string>} Names of ignored properties
* @param [white] {Array<string>} Names of compared properties, if the array is not empty
* @param [path] {String} Path to the current property in recursive processing
* @param [equal] {Function} Function for comparing values
* @param separator
* @param [result] {String} Returned result in recursive processing. Should not be used.
* @returns {{$unset: [], $set: {}}}
*/
export declare function diff<S = unknown, C = unknown>(source: S, compare: C, { ignore, white, path, equal, separator }: DiffOptions, result?: DiffResult): DiffResult | C;