Skip to content

extend

extend<D, O>(defaults, options): D & O

Defined in: core/utils/object.ts:20

Merges two objects into a new one. Values in options win over defaults.

Only own, enumerable properties are copied, and the merge is shallow. Neither argument is modified.

D extends object

Shape of the defaults.

O extends object

Shape of the options.

D

Default settings.

O

Settings that override the defaults.

D & O

A new object with the properties of both.

If either argument is not an object.

extend({ width: 700, align: 'center' }, { width: 400 });
// { width: 400, align: 'center' }