/
Phone API Reference - Extended - util.defaults

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

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 });

 

Related content

Phone API Reference - Extended - util
Phone API Reference - Extended - util
More like this
Phone API Reference - Extended - util.forceArray
Phone API Reference - Extended - util.forceArray
More like this
Phone API Reference - Extended - app.checkRequired
Phone API Reference - Extended - app.checkRequired
More like this
Phone API Reference - Extended Classes - Document
Phone API Reference - Extended Classes - Document
More like this
Phone API Reference - Classes
Phone API Reference - Classes
More like this
Phone API Reference - Extended - app
Phone API Reference - Extended - app
More like this

Return to Documentation Home I Return to Sangoma Support