super-utils-plus
Version:
A superior alternative to Lodash with improved performance, TypeScript support, and developer experience
27 lines (26 loc) • 555 B
TypeScript
/**
* Flattens array a single level deep.
*
* @param array - The array to flatten
* @returns The new flattened array
*
* @example
* ```ts
* flatten([1, [2, [3, [4]], 5]]);
* // => [1, 2, [3, [4]], 5]
* ```
*/
export declare function flatten<T>(array: Array<T | T[]>): T[];
/**
* Recursively flattens array.
*
* @param array - The array to flatten
* @returns The new flattened array
*
* @example
* ```ts
* flattenDeep([1, [2, [3, [4]], 5]]);
* // => [1, 2, 3, 4, 5]
* ```
*/
export declare function flattenDeep<T>(array: any[]): T[];