UNPKG

2.6 kBTypeScriptView Raw
1export * from "./index";
2declare module "./index" {
3 interface List<A> {
4 empty(): List<any>;
5 of<B>(b: B): List<B>;
6 append(value: A): List<A>;
7 nth(index: number): A | undefined;
8 prepend(value: A): List<A>;
9 append(value: A): List<A>;
10 first(): A | undefined;
11 last(): A | undefined;
12 map<B>(f: (a: A) => B): List<B>;
13 pluck<K extends keyof A>(key: K): List<A[K]>;
14 foldl<B>(f: (acc: B, value: A) => B, initial: B): B;
15 reduce<B>(f: (acc: B, value: A) => B, initial: B): B;
16 foldr<B>(f: (value: A, acc: B) => B, initial: B): B;
17 reduceRight<B>(f: (value: A, acc: B) => B, initial: B): B;
18 forEach(callback: (a: A) => void): void;
19 filter(predicate: (a: A) => boolean): List<A>;
20 reject(predicate: (a: A) => boolean): List<A>;
21 partition(predicate: (a: A) => boolean): List<List<A>>;
22 join(separator: string): string;
23 ap<B>(listF: List<(a: A) => B>): List<B>;
24 flatten(this: List<List<A>>): List<A>;
25 chain<B>(f: (a: A) => List<B>): List<B>;
26 every(predicate: (a: A) => boolean): boolean;
27 some(predicate: (a: A) => boolean): boolean;
28 none(predicate: (a: A) => boolean): boolean;
29 indexOf(element: A): number;
30 find(predicate: (a: A) => boolean): A | undefined;
31 findIndex(predicate: (a: A) => boolean): number;
32 includes(element: A): boolean;
33 equals(secondList: List<any>): boolean;
34 concat(right: List<A>): List<A>;
35 update(index: number, a: A): List<A>;
36 adjust(index: number, f: (a: A) => A): List<A>;
37 slice(from: number, to: number): List<A>;
38 take(n: number): List<A>;
39 takeWhile(predicate: (a: A) => boolean): List<A>;
40 takeLast(n: number): List<A>;
41 splitAt(index: number): [List<A>, List<A>];
42 remove(from: number, amount: number): List<A>;
43 drop(n: number): List<A>;
44 dropWhile(predicate: (a: A) => boolean): List<A>;
45 dropLast(n: number): List<A>;
46 pop(): List<A>;
47 tail(): List<A>;
48 toArray(): A[];
49 insert(index: number, element: A): List<A>;
50 insertAll(index: number, elements: List<A>): List<A>;
51 reverse(): List<A>;
52 zipWith<B, C>(f: (a: A, b: B) => C, bs: List<B>): List<C>;
53 zip<B>(bs: List<B>): List<[A, B]>;
54 sort<A extends Comparable>(this: List<A>, l: List<A>): List<A>;
55 sortBy<B extends Comparable>(f: (a: A) => B): List<A>;
56 sortWith(comparator: (a: A, b: A) => Ordering): List<A>;
57 }
58}
59
\No newline at end of file