Assign default options to an object.
The first argument has the highest priority, the last argument the lowest. Only properties that are undefined in the target object will be assigned from the source objects.
undefined
This is equivalent to _.defaults from Lodash.
_.defaults
The objects to merge.
The merged object.
const options = defaults( { a: 1 }, { a: 2, b: 2 }, { a: 3, b: 3, c: 3 });console.log(options); // { a: 1, b: 2, c: 3 } Copy
const options = defaults( { a: 1 }, { a: 2, b: 2 }, { a: 3, b: 3, c: 3 });console.log(options); // { a: 1, b: 2, c: 3 }
Assign default options to an object.
The first argument has the highest priority, the last argument the lowest. Only properties that are
undefined
in the target object will be assigned from the source objects.This is equivalent to
_.defaults
from Lodash.