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