source: node_modules/es-toolkit/dist/compat/object/defaultsDeep.d.mts

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/**
2 * Recursively assigns default values to an `object`, ensuring that certain properties do not remain `undefined`.
3 * It sets default values for properties that are either `undefined` or inherited from `Object.prototype`.
4 *
5 * Similar to `defaults` but recursively applies default values to nested objects.
6 * Source objects are applied in order from left to right, and once a property has been assigned a value,
7 * any subsequent values for that property will be ignored.
8 *
9 * Note: This function modifies the first argument, `object`.
10 *
11 * @template T - The type of the object being processed.
12 * @param {any} target - The target object that will receive default values.
13 * @param {any[]} sources - One or more source objects that specify default values to apply.
14 * @returns {any} The `object` that has been updated with default values from all sources, recursively merging nested objects.
15 *
16 * @example
17 * defaultsDeep({ a: { b: 2 } }, { a: { b: 3, c: 3 }, d: 4 }); // { a: { b: 2, c: 3 }, d: 4 }
18 * defaultsDeep({ a: { b: undefined } }, { a: { b: 1 } }); // { a: { b: 1 } }
19 * defaultsDeep({ a: null }, { a: { b: 1 } }); // { a: null }
20 */
21declare function defaultsDeep(target: any, ...sources: any[]): any;
22
23export { defaultsDeep };
Note: See TracBrowser for help on using the repository browser.