util.extend

Static function.

Function that copies properties from one or several JavaScript objects to another JavaScript object.

util.extend(target, ...source)

Parameters:

Parameter

Default value

Description

target*

ā€”

Type: Object

Target JavaScript object. It will be modified as a result of the function.

source*

ā€”

Type: Object

Source JavaScript object. All of its properties will be copied. There can be several sources (the function can have any number of parameters), and data is copied from right to left (the last argument has highest priority during copying).

* Mandatory parameter/option.

Example:

var options = ymaps.util.extend({
     prop1: 'a',
     prop2: 'b'
}, {
     prop2: 'c',
     prop3: 'd'
}, {
     prop3: 'e'
});
// We get the result: {
//     prop1: 'a',
//     prop2: 'c',
//     prop3: 'e'
//}