[d24f17c] | 1 | import { List } from './List';
|
---|
| 2 | import { _UnNest } from './UnNest';
|
---|
| 3 | import { Cast } from '../Any/Cast';
|
---|
| 4 | import { Equals } from '../Any/Equals';
|
---|
| 5 | import { Iteration } from '../Iteration/Iteration';
|
---|
| 6 | import { IterationOf } from '../Iteration/IterationOf';
|
---|
| 7 | import { Extends } from '../Any/Extends';
|
---|
| 8 | import { Next } from '../Iteration/Next';
|
---|
| 9 | import { Or } from '../Boolean/Or';
|
---|
| 10 | import { Boolean } from '../Boolean/_Internal';
|
---|
| 11 | /**
|
---|
| 12 | * @hidden
|
---|
| 13 | */
|
---|
| 14 | declare type __Flatten<L extends List, LO extends List, strict extends Boolean, limit extends Iteration, I extends Iteration = IterationOf<0>> = {
|
---|
| 15 | 0: __Flatten<_UnNest<L, strict>, L, strict, limit, Next<I>>;
|
---|
| 16 | 1: L;
|
---|
| 17 | }[Or<Equals<L, LO>, Extends<limit, I>>];
|
---|
| 18 | /**
|
---|
| 19 | * @hidden
|
---|
| 20 | */
|
---|
| 21 | export declare type _Flatten<L extends List, strict extends Boolean, limit extends number = number> = __Flatten<L, [], strict, IterationOf<limit>> extends infer X ? Cast<X, List> : never;
|
---|
| 22 | /**
|
---|
| 23 | * Remove all dimensions of `L` (10 max)
|
---|
| 24 | * @param L to un-nest
|
---|
| 25 | * @param strict (?=`1`) `0` to not preserve tuples
|
---|
| 26 | * @param limit (?=`string`) to stop un-nesting at
|
---|
| 27 | * @returns [[List]]
|
---|
| 28 | * @example
|
---|
| 29 | * ```ts
|
---|
| 30 | * ```
|
---|
| 31 | */
|
---|
| 32 | export declare type Flatten<L extends List, strict extends Boolean = 1, limit extends number = number> = L extends unknown ? _Flatten<L, strict, limit> : never;
|
---|
| 33 | export {};
|
---|