Phone API Reference - Extended - util.forceArray

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.forceArray

 

Description

Returns an array.

 

Basic Example: 

var newArray = util.forceArray(value[, key]);

If called with a single argument of an array, returns the argument forced into an array. Otherwise, returns a new array containing argument.

Also can be called with an object and property name. In this case, it uses object[propertyName] as the target.

If value (or value[key]) is undefined, returns an empty array.

Parameters

Name

Required

Type

Default

Description

Name

Required

Type

Default

Description

value

Yes

 

 

Value to be forced into an array.

key

No

string

 

If provided, value[key] is forced into an array.

 

Examples

util.forceArray returns an array

var param = 'foo'; util.forceArray(param);

util.forceArray returns an array, takes an object as the first parameter

var param = {'foo' : 'bar'}; util.forceArray(param, 'foo');

Return to Documentation Home I Return to Sangoma Support