Phone API Reference - Extended - util.defaults
Desk Phone API features described in this section are deprecated and supported only on the following models: D40, d45, d50, d60, d62, d65, d70
util.defaults
Description
Merges two objects and returns the result. For each key provided, the target object is checked for a corresponding key. If none is found, it will be created with the provided value. Keys in target that are defined will not be overwritten.
Basic Example:
util.defaults(target, object); |
Parameters
Name | Required | Type | Default | Description |
---|---|---|---|---|
target | Yes | object |
| The target object to be filled with values. |
object | Yes | object |
| The object containing properties to merge into target. |
Examples
util.defaults creates an object with properties 'foo' -> 'test', 'bar' -> 999
var target = {'foo' : 'test'};
target = util.defaults(target, {
'foo' : 'Target already contains property "foo", this property will not be merged',
'bar' : 999
}); |