Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
1c7200981This file is pinned to the selected release. Download the original to open it in your design tool.
/**
* Flatten the given array into a single array of elements.
*
* The given array can be composed of multiple depths of objects and or arrays.
*
* @param {Array} array - array to flatten
* @returns {Array} a flat array with a single list of elements
*
* @alias module:array-utils.flatten
* @function
*
* @example
* const flat = flatten([[1], [2, 3, [4, 5]], 6]) // returns [1, 2, 3, 4, 5, 6]
*/
export const flatten = (arr) => arr.flat(Infinity)