UNPKG

3.55 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 intersperse(separator: A): List<A>;
11 first(): A | undefined;
12 last(): A | undefined;
13 map<B>(f: (a: A) => B): List<B>;
14 pluck<K extends keyof A>(key: K): List<A[K]>;
15 foldl<B>(f: (acc: B, value: A) => B, initial: B): B;
16 reduce<B>(f: (acc: B, value: A) => B, initial: B): B;
17 scan<B>(f: (acc: B, value: A) => B, initial: B): List<B>;
18 foldr<B>(f: (value: A, acc: B) => B, initial: B): B;
19 reduceRight<B>(f: (value: A, acc: B) => B, initial: B): B;
20 traverse<A, B>(of: Of, f: (a: A) => Applicative<B>): any;
21 sequence<A, B>(this: List<Applicative<A>>, of: Of): any;
22 forEach(callback: (a: A) => void): void;
23 filter(predicate: (a: A) => boolean): List<A>;
24 filter<B extends A>(predicate: (a: A) => a is B): List<B>;
25 reject(predicate: (a: A) => boolean): List<A>;
26 partition(predicate: (a: A) => boolean): [List<A>, List<A>];
27 join(separator: string): string;
28 ap<B>(listF: List<(a: A) => B>): List<B>;
29 flatten(this: List<List<A>>): List<A>;
30 flatMap<B>(f: (a: A) => List<B>): List<B>;
31 chain<B>(f: (a: A) => List<B>): List<B>;
32 every(predicate: (a: A) => boolean): boolean;
33 some(predicate: (a: A) => boolean): boolean;
34 none(predicate: (a: A) => boolean): boolean;
35 indexOf(element: A): number;
36 lastIndexOf(element: A): number;
37 find(predicate: (a: A) => boolean): A | undefined;
38 findLast(predicate: (a: A) => boolean): A | undefined;
39 findIndex(predicate: (a: A) => boolean): number;
40 includes(element: A): boolean;
41 equals(secondList: List<any>): boolean;
42 equalsWith(f: (a: A, b: A) => boolean, secondList: List<any>): boolean;
43 concat(right: List<A>): List<A>;
44 update(index: number, a: A): List<A>;
45 adjust(index: number, f: (a: A) => A): List<A>;
46 slice(from: number, to: number): List<A>;
47 take(n: number): List<A>;
48 takeWhile(predicate: (a: A) => boolean): List<A>;
49 takeLastWhile(predicate: (a: A) => boolean): List<A>;
50 takeLast(n: number): List<A>;
51 splitAt(index: number): [List<A>, List<A>];
52 splitWhen(predicate: (a: A) => boolean): [List<A>, List<A>];
53 splitEvery(size: number): List<List<A>>;
54 remove(from: number, amount: number): List<A>;
55 drop(n: number): List<A>;
56 dropWhile(predicate: (a: A) => boolean): List<A>;
57 dropRepeats(): List<A>;
58 dropRepeatsWith(predicate: (a: A, b: A) => boolean): List<A>;
59 dropLast(n: number): List<A>;
60 pop(): List<A>;
61 tail(): List<A>;
62 toArray(): A[];
63 insert(index: number, element: A): List<A>;
64 insertAll(index: number, elements: List<A>): List<A>;
65 reverse(): List<A>;
66 zipWith<B, C>(f: (a: A, b: B) => C, bs: List<B>): List<C>;
67 zip<B>(bs: List<B>): List<[A, B]>;
68 sort<A extends Comparable>(this: List<A>, l: List<A>): List<A>;
69 sortBy<B extends Comparable>(f: (a: A) => B): List<A>;
70 sortWith(comparator: (a: A, b: A) => Ordering): List<A>;
71 group(): List<List<A>>;
72 groupWith<A>(f: (a: A, b: A) => boolean): List<List<A>>;
73 isEmpty(): boolean;
74 }
75}
76
\No newline at end of file