This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Flattens the array that contains nested arrays, optionally removing null or undefined elements. | |
* @example | |
* // returns [1, 2, 3, null, undefined, 4] | |
* [[1,2,[3,null],undefined],4].flatten() | |
* @example | |
* // returns [1, 2, 3, 4] | |
* [[1,2,[3,null],undefined],4].flatten(true) | |
* @param removeBlanks {boolean} If evaluates to true, strips any null or undefined array elements. | |
* @returns {Array} Flattened array of elements of the original array and any of its nested arrays. |