UNPKG

@alexaegis/common

Version:
31 lines 1.16 kB
import { DropKeyMatcher } from './drop-keys.function.js'; import { MergeTuple } from './tuple.type.js'; export interface DeepMergeOptions { /** * When set to true, if any of the sources set something to undefined * @default false */ preferUndefined?: boolean; /** * Wether or not to drop undefineds from the resulting merge before return * When set to true it will drop keys that are set to undefined. * When set to a matcher function it will drop only those keys. * * To use this functionally elsewhere see the * [`dropKeys`](./drop-keys.function.ts) function. * * This will happen at the last step * * @default false */ dropKeys?: boolean | DropKeyMatcher; } /** * Merges multiple objects in order into the first argument. * It mutates the target! Arrays are merged naively using === equality. * * Keys that are explicitly set to `undefined` among sources are dropped from * the target object. */ export declare const deepMerge: <T extends unknown[]>(sources: [...T], options?: DeepMergeOptions) => MergeTuple<T>; //# sourceMappingURL=deep-merge.function.d.ts.map