Edit this page

up.util up.util.wrapList(value)
JavaScript function

Returns the given value if it is array-like, otherwise returns an array with the given value as its only element.

Returns an empty array if called with null or undefined.

Example

up.util.wrapList([1, 2, 3]) // result: [1, 2, 3]
up.util.wrapList('foo') // result: [foo']'
up.util.wrapList(undefined) // result: []
up.util.wrapList(null) // result: []

Parameters

value
required
any

Return value