just-flatten-it
Advanced tools
Comparing version 4.0.0 to 4.1.0
type RecursiveList<T> = (T | T[] | RecursiveList<T>)[]; | ||
declare function flatten<T>(list: RecursiveList<T>, depth? : number): T[]; | ||
/** | ||
* Flattens an array | ||
* @param arr the arary to flatten | ||
* @param depth number of times to flatten the array. Flattens fully if omitted. | ||
* | ||
* @example | ||
* flatten([[1, [2, 3]], [[4, 5], 6, 7, [8, 9]]]); | ||
* // => [1, 2, 3, 4, 5, 6, 7, 8, 9] | ||
* flatten([[1, [2, 3]], [[4, 5], 6, 7, [8, 9]]], 1); | ||
* // => [1, [2, 3], [[4, 5], 6, 7, [8, 9]]] | ||
*/ | ||
declare function flatten<T>(arr: RecursiveList<T>, depth? : number): T[]; | ||
export default flatten; |
{ | ||
"name": "just-flatten-it", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "return a flattened array", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
3804
69