UNPKG

beta-parity-react

Version:

Beta Parity React Components

30 lines 1.38 kB
/** * Recursively merges two objects, preserving the original values unless overridden. * * - If a property in `source` is an object, it will be deeply merged into `target`. * - Otherwise, the value from `source` will overwrite the corresponding value in `target`. * * @template T The type of `target`, which must be an object. * @param {T} target The base object to be merged into. * @param {Partial<T>} source The object containing override values (can have missing properties). * @returns {T} A new merged object, leaving the original `target` unchanged. * * @memberof Utils */ export declare function deepMerge<T extends object>(target: T, source: Partial<T>): T; /** * Deeply clones an object, preserving special types like Date, Map, and Set. * * - Supports deep cloning of objects, arrays, primitives, Date, Map, and Set. * - Handles circular references by tracking visited objects. * - Does not clone functions, class instances, or prototype chains. * * @template T The type of the object to be cloned. * @param {T} obj The object to be deeply cloned. * @param {WeakMap<object, any>} [seen=new WeakMap()] A map to track circular references. * @returns {T} A new object that is a deep copy of the original. * * @memberof Utils */ export declare function deepCloneObject<T>(obj: T, seen?: WeakMap<object, any>): T; //# sourceMappingURL=utils.d.ts.map