Edit this page

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

This feature is experimental. It may be changed or removed in a future version.

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]) // => [1, 2, 3]
up.util.wrapList('foo') // => ['foo']
up.util.wrapList(undefined) // => []
up.util.wrapList(null) // => []

Parameters

value any

Return value

ArrayorNodeListorjQuery