Loading files
d037b79dcThis file is pinned to the selected release. Download the original to open it in your design tool.
/**
* Convert the given array to an array if not already an array.
*
* @param {*} array - anything
* @returns {Array} an array
*
* @alias module:array-utils.toArray
* @function
*
* @example
* const array = toArray(1) // returns [1]
*/
export const toArray = (array) => {
if (Array.isArray(array)) return array
if (array === undefined || array === null) return []
return [array]
}