src/util/Util.js
/**
 * Recursively flatten an array of arrays.
 *
 * @name module:util.flattenArray
 * @function
 * @public
 * @param {Array.<Object>} array - the input array of arrays
 * @returns {Array.<Object>} the flatten array
 */
Recursively flatten an array of arrays.
Recursively flatten an array of arrays .
function flattenArray(array)
{
	return array.reduce(
		(flat, next) =>
		{
			flat.push((Array.isArray(next) && Array.isArray(next[0])) ? flattenArray(next) : next);
			return flat;
		},
		[],
	);
}
function flattenArray ( array ) { return array . reduce ( ( flat , next ) => { flat . push ( ( Array . isArray ( next ) && Array . isArray ( next [ 0 ] ) ) ? flattenArray ( next ) : next ) ; return flat ; } , [ ] , ) ; }
Recursively flatten an array of arrays.
Recursively flatten an array of arrays .