UNPKG

828 BTypeScriptView Raw
1import { _Drop } from './Drop';
2import { _Take } from './Take';
3import { Cast } from '../Any/Cast';
4import { Append } from './Append';
5import { List } from './List';
6import { Extends } from '../Any/Extends';
7/**
8 * @hidden
9 */
10declare type __Group<L extends List, N extends number, LN extends List = []> = {
11 0: __Group<_Drop<L, N>, N, Append<LN, _Take<L, N>>>;
12 1: LN;
13}[Extends<L, List<never>>];
14/**
15 * @hidden
16 */
17export declare type _Group<L extends List, N extends number> = __Group<L, N> extends infer X ? Cast<X, List> : never;
18/**
19 * Split `L` into sub-[[List]]s every `N`
20 * @param L to group
21 * @param N to split at
22 * @returns [[List]]
23 * @example
24 * ```ts
25 * ```
26 */
27export declare type Group<L extends List, N extends number> = L extends unknown ? N extends unknown ? _Group<L, N> : never : never;
28export {};