1 | import { Tail } from './Tail';
|
---|
2 | import { Cast } from '../Any/Cast';
|
---|
3 | import { IterationOf } from '../Iteration/IterationOf';
|
---|
4 | import { Iteration } from '../Iteration/Iteration';
|
---|
5 | import { Way } from '../Iteration/_Internal';
|
---|
6 | import { List } from './List';
|
---|
7 | import { Pos } from '../Iteration/Pos';
|
---|
8 | import { Prev } from '../Iteration/Prev';
|
---|
9 | import { Prepend } from './Prepend';
|
---|
10 | import { Naked } from './_Internal';
|
---|
11 | import { Extends } from '../Any/Extends';
|
---|
12 | /**
|
---|
13 | * @hidden
|
---|
14 | */
|
---|
15 | declare type DropForth<L extends List, N extends Iteration> = {
|
---|
16 | 0: DropForth<Tail<L>, Prev<N>>;
|
---|
17 | 1: L;
|
---|
18 | }[Extends<0, Pos<N>>];
|
---|
19 | /**
|
---|
20 | * @hidden
|
---|
21 | */
|
---|
22 | declare type DropBack<L extends List, N extends Iteration, I extends Iteration = Prev<N>, LN extends List = []> = {
|
---|
23 | 0: DropBack<L, N, Prev<I>, Prepend<LN, L[Pos<I>]>>;
|
---|
24 | 1: LN;
|
---|
25 | }[Extends<-1, Pos<I>>];
|
---|
26 | /**
|
---|
27 | * @hidden
|
---|
28 | */
|
---|
29 | declare type __Drop<L extends List, N extends Iteration, way extends Way> = {
|
---|
30 | '->': DropForth<L, N>;
|
---|
31 | '<-': DropBack<L, N>;
|
---|
32 | }[way];
|
---|
33 | /**
|
---|
34 | * @hidden
|
---|
35 | */
|
---|
36 | export declare type _Drop<L extends List, N extends number, way extends Way = '->'> = __Drop<Naked<L>, IterationOf<N>, way> extends infer X ? Cast<X, List> : never;
|
---|
37 | /**
|
---|
38 | * Remove `N` entries out of `L`
|
---|
39 | * @param L to remove from
|
---|
40 | * @param N to remove out
|
---|
41 | * @param way (?=`'->'`) from front: '->', from end: '<-'
|
---|
42 | * @returns [[List]]
|
---|
43 | * @example
|
---|
44 | * ```ts
|
---|
45 | * ```
|
---|
46 | */
|
---|
47 | export declare type Drop<L extends List, N extends number, way extends Way = '->'> = L extends unknown ? N extends unknown ? _Drop<L, N, way> : never : never;
|
---|
48 | export {};
|
---|