defaults
defaults(
params):DefaultsResult
Defined in: objects/defaults/index.ts:32
Assigns default values from source to target for properties that are
undefined or missing. Existing null, 0, "", and false values are
preserved — only undefined triggers replacement.
Parameters
Section titled “Parameters”params
Section titled “params”DefaultsParams
The parameters object
Returns
Section titled “Returns”DefaultsResult
A new object (inputs are not mutated)
Example
Section titled “Example”defaults({ target: { a: 1 }, source: { a: 99, b: 2 } });// => { a: 1, b: 2 }Keywords
Section titled “Keywords”default values, fill undefined, fallback object, defaults, with defaults
lodash/defaults — semantic reference (https://lodash.com/docs/#defaults)
Throws
Section titled “Throws”Error if target is not a plain object
Throws
Section titled “Throws”Error if source is not a plain object