just-flatten-it
Advanced tools
Comparing version 5.1.1 to 5.1.2
# just-flatten-it | ||
## 5.1.2 | ||
### Patch Changes | ||
- Type improvements | ||
## 5.1.1 | ||
@@ -4,0 +10,0 @@ |
@@ -1,2 +0,2 @@ | ||
type RecursiveList<T> = (T | T[] | RecursiveList<T>)[]; | ||
type RecursiveList<T> = readonly (T | readonly T[] | RecursiveList<T>)[]; | ||
@@ -14,3 +14,3 @@ /** | ||
*/ | ||
declare function flatten<T>(arr: RecursiveList<T>, depth? : number): T[]; | ||
declare function flatten<T>(arr: RecursiveList<T>, depth?: number): T[]; | ||
export default flatten; |
import flatten from './index' | ||
// OK | ||
flatten([1, 2, 3]); | ||
flatten([1, [2, 3], 4]); | ||
flatten([1, [2, [3]], 4]); | ||
flatten([1, [2, [3]], [[[[[4]]]]]]); | ||
const numbers: readonly number[] = [1, 2, 3] | ||
flatten(numbers); | ||
flatten([1, numbers, 4]); | ||
flatten([1, [2, numbers], 4]); | ||
flatten([1, [2, [3]], [[[[numbers]]]]]); | ||
flatten([1, [2, [3]], [[[[[4]]]]]], 2); | ||
@@ -19,3 +20,3 @@ flatten([1, [2, [3]], [[[[[4]]]]]], undefined); | ||
// @ts-expect-error | ||
flatten({a: 5}); | ||
flatten({ a: 5 }); | ||
// @ts-expect-error | ||
@@ -22,0 +23,0 @@ flatten([1], true); |
{ | ||
"name": "just-flatten-it", | ||
"version": "5.1.1", | ||
"version": "5.1.2", | ||
"description": "return a flattened array", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5472
101