functype 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-3RJPXVXE.js +1 -0
- package/dist/chunk-5DQWEDA3.js +1 -0
- package/dist/chunk-6RUUD24R.mjs +1 -0
- package/dist/chunk-BFK2RZ2Z.js +1 -0
- package/dist/chunk-BNNK42JC.js +1 -0
- package/dist/chunk-BYPZZZTG.js +1 -0
- package/dist/chunk-DFWZ7ANA.mjs +1 -0
- package/dist/chunk-DP5G2LT6.mjs +1 -0
- package/dist/{chunk-SSP26X5Y.js → chunk-FQY6BMNG.js} +1 -1
- package/dist/chunk-LGUIG2RX.mjs +1 -0
- package/dist/chunk-Q4H3PCBH.mjs +0 -0
- package/dist/{chunk-VM6KG6UB.mjs → chunk-RMQF6I4T.mjs} +1 -1
- package/dist/chunk-RRAIFS3D.mjs +1 -0
- package/dist/chunk-SDHW57XQ.js +1 -0
- package/dist/chunk-TAJ6OYCN.mjs +1 -0
- package/dist/chunk-V2J3R5IU.mjs +0 -0
- package/dist/chunk-X52Z6M5P.mjs +1 -0
- package/dist/chunk-XORABVON.js +1 -0
- package/dist/chunk-XVHCBGUW.js +1 -0
- package/dist/chunk-ZTTAUZK3.js +1 -0
- package/dist/collections/index.d.mts +3 -0
- package/dist/collections/index.d.ts +3 -0
- package/dist/collections/index.js +1 -0
- package/dist/collections/index.mjs +0 -0
- package/dist/either/Either.d.mts +3 -0
- package/dist/either/Either.d.ts +3 -0
- package/dist/either/Either.js +1 -0
- package/dist/either/Either.mjs +1 -0
- package/dist/either/index.d.mts +3 -2
- package/dist/either/index.d.ts +3 -2
- package/dist/either/index.js +1 -1
- package/dist/either/index.mjs +1 -1
- package/dist/functor/index.d.mts +17 -0
- package/dist/functor/index.d.ts +17 -0
- package/dist/functor/index.js +1 -0
- package/dist/functor/index.mjs +1 -0
- package/dist/index-3866f956.d.ts +227 -0
- package/dist/index-5f972212.d.ts +227 -0
- package/dist/index.d.mts +3 -212
- package/dist/index.d.ts +3 -212
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/iterable/Seq.d.mts +3 -0
- package/dist/iterable/Seq.d.ts +3 -0
- package/dist/iterable/Seq.js +1 -0
- package/dist/iterable/Seq.mjs +1 -0
- package/dist/iterable/index.d.mts +3 -0
- package/dist/iterable/index.d.ts +3 -0
- package/dist/iterable/index.js +1 -0
- package/dist/iterable/index.mjs +1 -0
- package/dist/list/List.d.mts +3 -2
- package/dist/list/List.d.ts +3 -2
- package/dist/list/List.js +1 -1
- package/dist/list/List.mjs +1 -1
- package/dist/list/index.d.mts +3 -2
- package/dist/list/index.d.ts +3 -2
- package/dist/list/index.js +1 -1
- package/dist/list/index.mjs +1 -1
- package/dist/map/Map.d.mts +3 -2
- package/dist/map/Map.d.ts +3 -2
- package/dist/map/Map.js +1 -1
- package/dist/map/Map.mjs +1 -1
- package/dist/map/index.d.mts +3 -2
- package/dist/map/index.d.ts +3 -2
- package/dist/map/index.js +1 -1
- package/dist/map/index.mjs +1 -1
- package/dist/option/Option.d.mts +3 -0
- package/dist/option/Option.d.ts +3 -0
- package/dist/option/Option.js +1 -0
- package/dist/option/Option.mjs +1 -0
- package/dist/option/index.d.mts +3 -2
- package/dist/option/index.d.ts +3 -2
- package/dist/option/index.js +1 -1
- package/dist/option/index.mjs +1 -1
- package/dist/set/Set.d.mts +3 -2
- package/dist/set/Set.d.ts +3 -2
- package/dist/set/Set.js +1 -1
- package/dist/set/Set.mjs +1 -1
- package/dist/set/index.d.mts +3 -2
- package/dist/set/index.d.ts +3 -2
- package/dist/set/index.js +1 -1
- package/dist/set/index.mjs +1 -1
- package/dist/try/Try.d.mts +3 -0
- package/dist/try/Try.d.ts +3 -0
- package/dist/try/Try.js +1 -0
- package/dist/try/Try.mjs +1 -0
- package/dist/try/index.d.mts +3 -0
- package/dist/try/index.d.ts +3 -0
- package/dist/try/index.js +1 -0
- package/dist/try/index.mjs +1 -0
- package/dist/tuple/Tuple.d.mts +19 -2
- package/dist/tuple/Tuple.d.ts +19 -2
- package/dist/tuple/Tuple.js +1 -1
- package/dist/tuple/Tuple.mjs +1 -1
- package/dist/tuple/index.d.mts +2 -2
- package/dist/tuple/index.d.ts +2 -2
- package/dist/tuple/index.js +1 -1
- package/dist/tuple/index.mjs +1 -1
- package/dist/util/index.d.mts +8 -0
- package/dist/util/index.d.ts +8 -0
- package/dist/util/index.js +1 -0
- package/dist/util/index.mjs +1 -0
- package/dist/util/isIterable.d.mts +3 -0
- package/dist/util/isIterable.d.ts +3 -0
- package/dist/util/isIterable.js +1 -0
- package/dist/util/isIterable.mjs +1 -0
- package/package.json +1 -1
- package/dist/chunk-7VFL33KH.js +0 -1
- package/dist/chunk-7XCWDOMW.js +0 -1
- package/dist/chunk-CZKHN2SM.mjs +0 -1
- package/dist/chunk-PKWOSOD7.mjs +0 -1
- package/dist/chunk-U237FVPP.mjs +0 -1
- package/dist/chunk-VWFTFPZB.mjs +0 -1
- package/dist/chunk-WY62QD3C.js +0 -1
- package/dist/chunk-XNAZ5QU3.js +0 -1
- package/dist/either/Left.d.mts +0 -2
- package/dist/either/Left.d.ts +0 -2
- package/dist/either/Left.js +0 -1
- package/dist/either/Left.mjs +0 -1
- package/dist/either/Right.d.mts +0 -2
- package/dist/either/Right.d.ts +0 -2
- package/dist/either/Right.js +0 -1
- package/dist/either/Right.mjs +0 -1
- package/dist/option/None.d.mts +0 -2
- package/dist/option/None.d.ts +0 -2
- package/dist/option/None.js +0 -1
- package/dist/option/None.mjs +0 -1
- package/dist/option/Some.d.mts +0 -2
- package/dist/option/Some.d.ts +0 -2
- package/dist/option/Some.js +0 -1
- package/dist/option/Some.mjs +0 -1
- /package/dist/{chunk-DOG6HMTN.js → chunk-6BEXQNLZ.js} +0 -0
- /package/dist/{chunk-72IAI5F4.mjs → chunk-74TKYQJS.mjs} +0 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { Type, IFunctor } from './functor/index.mjs';
|
|
2
|
+
import { ITuple, Tuple } from './tuple/Tuple.mjs';
|
|
3
|
+
|
|
4
|
+
interface Option<T extends Type> extends IFunctor<T>, ITraversable<T> {
|
|
5
|
+
get(): T;
|
|
6
|
+
getOrElse(defaultValue: T): T;
|
|
7
|
+
orElse(alternative: Option<T>): Option<T>;
|
|
8
|
+
map<U extends Type>(f: (value: T) => U): Option<U>;
|
|
9
|
+
flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
|
|
10
|
+
toList(): IIterable<T>;
|
|
11
|
+
}
|
|
12
|
+
declare class Some<A extends Type> implements Option<A> {
|
|
13
|
+
private value;
|
|
14
|
+
constructor(value: A);
|
|
15
|
+
get isEmpty(): boolean;
|
|
16
|
+
get(): A;
|
|
17
|
+
getOrElse(defaultValue: A): A;
|
|
18
|
+
orElse(alternative: Option<A>): Option<A>;
|
|
19
|
+
map<U extends Type>(f: (value: A) => U): Option<U>;
|
|
20
|
+
flatMap<U extends Type>(f: (value: A) => Option<U>): Option<U>;
|
|
21
|
+
reduce<U>(f: (acc: U, value: A) => U): U;
|
|
22
|
+
reduceRight<U>(f: (acc: U, value: A) => U): U;
|
|
23
|
+
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
24
|
+
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
25
|
+
toList(): IIterable<A>;
|
|
26
|
+
contains(value: A): boolean;
|
|
27
|
+
get size(): number;
|
|
28
|
+
}
|
|
29
|
+
declare class None<A extends Type> implements Option<A> {
|
|
30
|
+
get isEmpty(): boolean;
|
|
31
|
+
get(): A;
|
|
32
|
+
getOrElse(defaultValue: A): A;
|
|
33
|
+
orElse(alternative: Option<A>): Option<A>;
|
|
34
|
+
map<U extends Type>(f: (value: A) => U): Option<U>;
|
|
35
|
+
flatMap<U extends Type>(f: (value: A) => Option<U>): Option<U>;
|
|
36
|
+
reduce(f: (acc: A, value: A) => A): A;
|
|
37
|
+
reduceRight(f: (b: A, a: A) => A): A;
|
|
38
|
+
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
39
|
+
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
40
|
+
toList(): IIterable<A>;
|
|
41
|
+
contains(value: A): boolean;
|
|
42
|
+
get size(): number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare const option: <T extends unknown>(value?: T | undefined) => Option<T>;
|
|
46
|
+
declare const some: <T extends unknown>(value: T) => Option<T>;
|
|
47
|
+
declare const none: <T extends unknown>() => Option<T>;
|
|
48
|
+
|
|
49
|
+
declare class Seq<A> implements IIterable<A> {
|
|
50
|
+
protected readonly values: Iterable<A>;
|
|
51
|
+
constructor(values?: Iterable<A> | IIterable<A>);
|
|
52
|
+
readonly [n: number]: A;
|
|
53
|
+
get length(): number;
|
|
54
|
+
map<B>(f: (a: A) => B): IIterable<B>;
|
|
55
|
+
flatMap<B>(f: (a: A) => IIterable<B>): IIterable<B>;
|
|
56
|
+
forEach(f: (a: A) => void): void;
|
|
57
|
+
count(p: (x: A) => boolean): number;
|
|
58
|
+
exists(p: (a: A) => boolean): Boolean;
|
|
59
|
+
filter(p: (a: A) => boolean): IIterable<A>;
|
|
60
|
+
filterNot(p: (a: A) => boolean): IIterable<A>;
|
|
61
|
+
find(p: (a: A) => boolean): Option<A>;
|
|
62
|
+
get head(): A;
|
|
63
|
+
get headOption(): Option<A>;
|
|
64
|
+
get isEmpty(): boolean;
|
|
65
|
+
get size(): number;
|
|
66
|
+
toArray(): A[];
|
|
67
|
+
reduce(f: (prev: A, curr: A) => A): A;
|
|
68
|
+
reduceRight(f: (prev: A, curr: A) => A): A;
|
|
69
|
+
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
70
|
+
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface IIterable<A extends Type> extends IFunctor<A> {
|
|
74
|
+
count(p: (x: A) => boolean): number;
|
|
75
|
+
find(p: (a: A) => boolean): Option<A>;
|
|
76
|
+
forEach(f: (a: A) => void): void;
|
|
77
|
+
exists(p: (a: A) => boolean): Boolean;
|
|
78
|
+
filter(p: (a: A) => boolean): IIterable<A>;
|
|
79
|
+
filterNot(p: (a: A) => boolean): IIterable<A>;
|
|
80
|
+
reduce(f: (b: A, a: A) => A): A;
|
|
81
|
+
reduceRight(f: (b: A, a: A) => A): A;
|
|
82
|
+
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
83
|
+
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
84
|
+
get head(): A;
|
|
85
|
+
get headOption(): Option<A>;
|
|
86
|
+
get isEmpty(): boolean;
|
|
87
|
+
map<B extends Type>(f: (a: A) => B): IIterable<B>;
|
|
88
|
+
flatMap<B extends Type>(f: (a: A) => IIterable<B>): IIterable<B>;
|
|
89
|
+
get size(): number;
|
|
90
|
+
toArray(): readonly A[];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface ISet<T> extends IIterable<T>, ICollection<T> {
|
|
94
|
+
has(value: T): boolean;
|
|
95
|
+
}
|
|
96
|
+
declare class Set<A> extends Seq<A> implements ISet<A> {
|
|
97
|
+
constructor(iterable?: Iterable<A>);
|
|
98
|
+
add(value: A): Set<A>;
|
|
99
|
+
remove(value: A): Set<A>;
|
|
100
|
+
contains(value: A): boolean;
|
|
101
|
+
has(value: A): boolean;
|
|
102
|
+
map<B>(f: (a: A) => B): Set<B>;
|
|
103
|
+
flatMap<B>(f: (a: A) => IIterable<B>): Set<B>;
|
|
104
|
+
toList(): IList<A>;
|
|
105
|
+
toSet(): ISet<A>;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
interface IConverters<A> {
|
|
109
|
+
toList(): IList<A>;
|
|
110
|
+
toSet(): ISet<A>;
|
|
111
|
+
}
|
|
112
|
+
interface ICollection<A> extends IConverters<A> {
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
interface IList<T> extends IIterable<T>, ArrayLike<T> {
|
|
116
|
+
add(item: T): IList<T>;
|
|
117
|
+
}
|
|
118
|
+
declare class List<A> extends Seq<A> implements IList<A>, ICollection<A> {
|
|
119
|
+
constructor(values?: Iterable<A> | IIterable<A>);
|
|
120
|
+
readonly [n: number]: A;
|
|
121
|
+
map<B>(f: (a: A) => B): List<B>;
|
|
122
|
+
flatMap<B>(f: (a: A) => IIterable<B>): List<B>;
|
|
123
|
+
remove(value: A): List<A>;
|
|
124
|
+
contains(value: A): boolean;
|
|
125
|
+
add(item: A): List<A>;
|
|
126
|
+
removeAt(index: number): List<A>;
|
|
127
|
+
get(index: number): Option<A>;
|
|
128
|
+
concat(other: List<A>): List<A>;
|
|
129
|
+
toList(): IList<A>;
|
|
130
|
+
toSet(): Set<A>;
|
|
131
|
+
toString(): string;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
declare const list: <T extends unknown>(items: T[] | undefined) => List<T>;
|
|
135
|
+
|
|
136
|
+
interface IMap<K, V> extends ITraversable<ITuple<[K, V]>>, ICollection<ITuple<[K, V]>> {
|
|
137
|
+
map<U>(f: (value: any) => U): IMap<K, U>;
|
|
138
|
+
flatMap<U>(f: (value: any) => IMap<K, U>): IMap<K, U>;
|
|
139
|
+
get(key: K): Option<V>;
|
|
140
|
+
getOrElse(key: K, defaultValue: V): V;
|
|
141
|
+
orElse(key: K, alternative: Option<V>): Option<V>;
|
|
142
|
+
}
|
|
143
|
+
declare class Map<K, V> implements IMap<K, V> {
|
|
144
|
+
private values;
|
|
145
|
+
private get entries();
|
|
146
|
+
constructor(entries?: readonly (readonly [K, V])[] | IterableIterator<[K, V]> | null);
|
|
147
|
+
add(item: ITuple<[K, V]>): Map<K, V>;
|
|
148
|
+
remove(value: ITuple<[K, V]>): Map<K, V>;
|
|
149
|
+
contains(value: ITuple<[K, V]>): boolean;
|
|
150
|
+
get size(): number;
|
|
151
|
+
map<U>(f: (value: V) => U): IMap<K, U>;
|
|
152
|
+
flatMap<U>(f: (value: V) => IMap<K, U>): IMap<K, U>;
|
|
153
|
+
reduce(f: (acc: Tuple<[K, V]>, value: Tuple<[K, V]>) => Tuple<[K, V]>): Tuple<[K, V]>;
|
|
154
|
+
reduceRight(f: (acc: Tuple<[K, V]>, value: Tuple<[K, V]>) => Tuple<[K, V]>): Tuple<[K, V]>;
|
|
155
|
+
foldLeft<B>(z: B): (op: (b: B, a: ITuple<[K, V]>) => B) => B;
|
|
156
|
+
foldRight<B>(z: B): (op: (a: ITuple<[K, V]>, b: B) => B) => B;
|
|
157
|
+
get(key: K): Option<V>;
|
|
158
|
+
getOrElse(key: K, defaultValue: V): V;
|
|
159
|
+
get isEmpty(): boolean;
|
|
160
|
+
orElse(key: K, alternative: Option<V>): Option<V>;
|
|
161
|
+
toList(): IList<Tuple<[K, V]>>;
|
|
162
|
+
toSet(): ISet<Tuple<[K, V]>>;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
interface Either<L, R> extends IFunctor<R> {
|
|
166
|
+
value: L | R;
|
|
167
|
+
isLeft(): this is Left<L, R>;
|
|
168
|
+
isRight(): this is Right<L, R>;
|
|
169
|
+
map<U>(f: (value: R) => U): Either<L, U>;
|
|
170
|
+
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
171
|
+
toOption(): Option<R>;
|
|
172
|
+
toList(): List<R>;
|
|
173
|
+
}
|
|
174
|
+
declare class Right<L, R> implements Either<L, R> {
|
|
175
|
+
value: R;
|
|
176
|
+
constructor(value: R);
|
|
177
|
+
isLeft(): this is Left<L, R>;
|
|
178
|
+
isRight(): this is Right<L, R>;
|
|
179
|
+
map<U>(f: (value: R) => U): Either<L, U>;
|
|
180
|
+
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
181
|
+
toOption(): Option<R>;
|
|
182
|
+
toList(): List<R>;
|
|
183
|
+
}
|
|
184
|
+
declare class Left<L, R> implements Either<L, R> {
|
|
185
|
+
value: L;
|
|
186
|
+
constructor(value: L);
|
|
187
|
+
isLeft(): this is Left<L, R>;
|
|
188
|
+
isRight(): this is Right<L, R>;
|
|
189
|
+
map<U>(_f: (value: R) => U): Either<L, U>;
|
|
190
|
+
flatMap<U>(_f: (value: R) => Either<L, U>): Either<L, U>;
|
|
191
|
+
toOption(): Option<R>;
|
|
192
|
+
toList(): List<R>;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
declare const left: <L, R>(value: L) => Either<L, R>;
|
|
196
|
+
declare const right: <L, R>(value: R) => Either<L, R>;
|
|
197
|
+
|
|
198
|
+
interface ITry<T> {
|
|
199
|
+
isSuccess(): boolean;
|
|
200
|
+
isFailure(): boolean;
|
|
201
|
+
getOrElse(defaultValue: T): T;
|
|
202
|
+
orElse(alternative: ITry<T>): ITry<T>;
|
|
203
|
+
toEither(): Either<Error, T>;
|
|
204
|
+
}
|
|
205
|
+
declare class Try<T> implements ITry<T> {
|
|
206
|
+
private readonly value;
|
|
207
|
+
private readonly error;
|
|
208
|
+
private constructor();
|
|
209
|
+
static of<T>(f: () => T): Try<T>;
|
|
210
|
+
isSuccess(): boolean;
|
|
211
|
+
isFailure(): boolean;
|
|
212
|
+
getOrElse(defaultValue: T): T;
|
|
213
|
+
orElse(alternative: ITry<T>): ITry<T>;
|
|
214
|
+
toEither(): Either<Error, T>;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
interface ITraversable<A extends Type> extends IFunctor<A> {
|
|
218
|
+
get size(): number;
|
|
219
|
+
get isEmpty(): boolean;
|
|
220
|
+
contains(value: A): boolean;
|
|
221
|
+
reduce(f: (b: A, a: A) => A): A;
|
|
222
|
+
reduceRight(f: (b: A, a: A) => A): A;
|
|
223
|
+
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
224
|
+
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export { Either as E, IIterable as I, List as L, Map as M, None as N, Option as O, Right as R, Some as S, Try as T, Seq as a, ISet as b, Set as c, IConverters as d, ICollection as e, IList as f, IMap as g, Left as h, left as i, ITry as j, ITraversable as k, list as l, none as n, option as o, right as r, some as s };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,212 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: L;
|
|
5
|
-
constructor(value: L);
|
|
6
|
-
isLeft(): this is Left<L, R>;
|
|
7
|
-
isRight(): this is Right<L, R>;
|
|
8
|
-
map<U>(_f: (value: R) => U): Either<L, U>;
|
|
9
|
-
flatMap<U>(_f: (value: R) => Either<L, U>): Either<L, U>;
|
|
10
|
-
toOption(): Option<R>;
|
|
11
|
-
toList(): List<R>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
declare class Right<L, R> implements Either<L, R> {
|
|
15
|
-
value: R;
|
|
16
|
-
constructor(value: R);
|
|
17
|
-
isLeft(): this is Left<L, R>;
|
|
18
|
-
isRight(): this is Right<L, R>;
|
|
19
|
-
map<U>(f: (value: R) => U): Either<L, U>;
|
|
20
|
-
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
21
|
-
toOption(): Option<R>;
|
|
22
|
-
toList(): List<R>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface Either<L, R> extends IFunctor<R> {
|
|
26
|
-
value: L | R;
|
|
27
|
-
isLeft(): this is Left<L, R>;
|
|
28
|
-
isRight(): this is Right<L, R>;
|
|
29
|
-
map<U>(f: (value: R) => U): Either<L, U>;
|
|
30
|
-
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
31
|
-
toOption(): Option<R>;
|
|
32
|
-
toList(): List<R>;
|
|
33
|
-
}
|
|
34
|
-
declare const left: <L, R>(value: L) => Either<L, R>;
|
|
35
|
-
declare const right: <L, R>(value: R) => Either<L, R>;
|
|
36
|
-
declare const parseNumber: (input: string) => Either<ParseError, number>;
|
|
37
|
-
|
|
38
|
-
declare class Some<T extends Type> implements Option<T> {
|
|
39
|
-
private value;
|
|
40
|
-
constructor(value: T);
|
|
41
|
-
get isEmpty(): boolean;
|
|
42
|
-
get(): T;
|
|
43
|
-
getOrElse(defaultValue: T): T;
|
|
44
|
-
orElse(alternative: Option<T>): Option<T>;
|
|
45
|
-
map<U extends Type>(f: (value: T) => U): Option<U>;
|
|
46
|
-
flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
|
|
47
|
-
reduce<U>(f: (acc: U, value: T) => U): U;
|
|
48
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
49
|
-
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
50
|
-
toList(): List<T>;
|
|
51
|
-
contains(value: T): boolean;
|
|
52
|
-
get size(): number;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
declare class None<T extends Type> implements Option<T> {
|
|
56
|
-
get isEmpty(): boolean;
|
|
57
|
-
get(): T;
|
|
58
|
-
getOrElse(defaultValue: T): T;
|
|
59
|
-
orElse(alternative: Option<T>): Option<T>;
|
|
60
|
-
map<U extends Type>(f: (value: T) => U): Option<U>;
|
|
61
|
-
flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
|
|
62
|
-
reduce<U>(f: (acc: U, value: T) => U): U;
|
|
63
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
64
|
-
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
65
|
-
toList(): List<T>;
|
|
66
|
-
contains(value: T): boolean;
|
|
67
|
-
get size(): number;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
interface Option<T extends Type> extends IFunctor<T>, ITraversable<T> {
|
|
71
|
-
get(): T;
|
|
72
|
-
getOrElse(defaultValue: T): T;
|
|
73
|
-
orElse(alternative: Option<T>): Option<T>;
|
|
74
|
-
map<U extends Type>(f: (value: T) => U): Option<U>;
|
|
75
|
-
flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
|
|
76
|
-
toList(): List<T>;
|
|
77
|
-
}
|
|
78
|
-
declare const option: <T extends unknown>(value?: T | undefined) => Option<T>;
|
|
79
|
-
declare const some: <T extends unknown>(value: T) => Option<T>;
|
|
80
|
-
declare const none: <T extends unknown>() => Option<T>;
|
|
81
|
-
|
|
82
|
-
declare class List<T> implements IList<T> {
|
|
83
|
-
private readonly items;
|
|
84
|
-
constructor(iterable?: Iterable<T>);
|
|
85
|
-
readonly [n: number]: T;
|
|
86
|
-
remove(value: T): List<T>;
|
|
87
|
-
contains(value: T): boolean;
|
|
88
|
-
get size(): number;
|
|
89
|
-
get isEmpty(): boolean;
|
|
90
|
-
get length(): number;
|
|
91
|
-
add(item: T): List<T>;
|
|
92
|
-
removeAt(index: number): List<T>;
|
|
93
|
-
get(index: number): Option<T>;
|
|
94
|
-
toArray(): readonly T[];
|
|
95
|
-
map<U>(f: (value: T) => U): List<U>;
|
|
96
|
-
flatMap<U>(f: (value: T) => List<U>): List<U>;
|
|
97
|
-
reduce<U>(f: (acc: U, value: T) => U): U;
|
|
98
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
99
|
-
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
100
|
-
concat(other: List<T>): List<T>;
|
|
101
|
-
toString(): string;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
interface IList<T extends Type> extends IFunctor<T>, ICollection<T>, ArrayLike<T> {
|
|
105
|
-
map<U extends Type>(f: (value: T) => U): IList<U>;
|
|
106
|
-
flatMap<U extends Type>(f: (value: T) => IList<U>): IList<U>;
|
|
107
|
-
reduce<U extends Type>(f: (acc: U, value: T) => U): U;
|
|
108
|
-
foldLeft<U extends Type>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
109
|
-
foldRight<U extends Type>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
110
|
-
}
|
|
111
|
-
declare const list: <T extends unknown>(items: T[] | undefined) => List<T>;
|
|
112
|
-
|
|
113
|
-
declare class Tuple<T extends ArrayType> implements ITuple<T> {
|
|
114
|
-
private readonly values;
|
|
115
|
-
constructor(values: T);
|
|
116
|
-
map<U extends ArrayType>(f: (value: T) => U): Tuple<U>;
|
|
117
|
-
flatMap<U extends ArrayType>(f: (value: T) => Tuple<U>): Tuple<U>;
|
|
118
|
-
get(index: number): T[number];
|
|
119
|
-
getAs<U>(index: number, f?: (item: T) => boolean): U;
|
|
120
|
-
toArray(): T;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
interface ITuple<T extends ArrayType> extends IArrayFunctor<T> {
|
|
124
|
-
get(index: number): T[number];
|
|
125
|
-
getAs<U>(index: number, f?: (item: T) => boolean): U;
|
|
126
|
-
map<U extends any[]>(f: (value: T) => U): ITuple<U>;
|
|
127
|
-
flatMap<U extends any[]>(f: (value: T) => ITuple<U>): ITuple<U>;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
declare class Map<K, V> implements IMap<K, V> {
|
|
131
|
-
private internalMap;
|
|
132
|
-
constructor(entries?: [K, V][]);
|
|
133
|
-
add(item: K): Map<K, V>;
|
|
134
|
-
remove(value: ITuple<[K, V]>): Map<K, V>;
|
|
135
|
-
contains(value: ITuple<[K, V]>): boolean;
|
|
136
|
-
get size(): number;
|
|
137
|
-
map<U extends Type>(f: (value: V) => U): IMap<K, U>;
|
|
138
|
-
flatMap<U extends Type>(f: (value: V) => IMap<K, U>): IMap<K, U>;
|
|
139
|
-
reduce<U extends ITuple<[K, V]>>(f: (acc: U, value: ITuple<[K, V]>) => U): U;
|
|
140
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: ITuple<[K, V]>) => U): U;
|
|
141
|
-
foldRight<U>(initialValue: U, f: (value: ITuple<[K, V]>, acc: U) => U): U;
|
|
142
|
-
get(key: K): Option<V>;
|
|
143
|
-
getOrElse(key: K, defaultValue: V): V;
|
|
144
|
-
get isEmpty(): boolean;
|
|
145
|
-
orElse(key: K, alternative: Option<V>): Option<V>;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
interface IMap<K, V> extends IFunctor<ITuple<[K, V]>>, ITraversable<ITuple<[K, V]>> {
|
|
149
|
-
map<U>(f: (value: any) => U): IMap<K, U>;
|
|
150
|
-
flatMap<U>(f: (value: any) => IMap<K, U>): IMap<K, U>;
|
|
151
|
-
reduce<U extends ITuple<[K, V]>>(f: (acc: U, value: ITuple<[K, V]>) => U): U;
|
|
152
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: ITuple<[K, V]>) => U): U;
|
|
153
|
-
foldRight<U>(initialValue: U, f: (value: ITuple<[K, V]>, acc: U) => U): U;
|
|
154
|
-
get(key: K): Option<V>;
|
|
155
|
-
getOrElse(key: K, defaultValue: V): V;
|
|
156
|
-
orElse(key: K, alternative: Option<V>): Option<V>;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
declare class Set<T> implements ISet<T>, ICollection<T> {
|
|
160
|
-
private readonly internalSet;
|
|
161
|
-
constructor(iterable?: Iterable<T>);
|
|
162
|
-
add(value: T): Set<T>;
|
|
163
|
-
remove(value: T): Set<T>;
|
|
164
|
-
contains(value: T): boolean;
|
|
165
|
-
get size(): number;
|
|
166
|
-
get isEmpty(): boolean;
|
|
167
|
-
map<U>(f: (value: T) => U): ISet<U>;
|
|
168
|
-
flatMap<U>(f: (value: T) => ISet<U>): ISet<U>;
|
|
169
|
-
reduce<U>(f: (acc: U, value: T) => U): U;
|
|
170
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
171
|
-
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
172
|
-
has(value: T): boolean;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
interface ISet<T> extends IFunctor<T> {
|
|
176
|
-
map<U>(f: (value: T) => U): ISet<U>;
|
|
177
|
-
flatMap<U>(f: (value: T) => ISet<U>): ISet<U>;
|
|
178
|
-
reduce<U>(f: (acc: U, value: T) => U): U;
|
|
179
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
180
|
-
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
181
|
-
has(value: T): boolean;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
type SingleType = any;
|
|
185
|
-
type ArrayType = SingleType[];
|
|
186
|
-
type Type = SingleType | ArrayType;
|
|
187
|
-
interface AbstractFunctor<T extends Type> {
|
|
188
|
-
map(f: (value: T) => Type): AbstractFunctor<Type>;
|
|
189
|
-
flatMap(f: (value: T) => AbstractFunctor<Type>): AbstractFunctor<Type>;
|
|
190
|
-
}
|
|
191
|
-
interface IFunctor<T extends Type> extends AbstractFunctor<T> {
|
|
192
|
-
map<U extends Type>(f: (value: T) => U): IFunctor<U>;
|
|
193
|
-
flatMap<U extends Type>(f: (value: T) => IFunctor<U>): IFunctor<U>;
|
|
194
|
-
}
|
|
195
|
-
interface IArrayFunctor<T extends ArrayType> extends AbstractFunctor<T> {
|
|
196
|
-
map<U extends ArrayType>(f: (value: T) => U): IArrayFunctor<U>;
|
|
197
|
-
flatMap<U extends ArrayType>(f: (value: T) => IArrayFunctor<U>): IArrayFunctor<U>;
|
|
198
|
-
}
|
|
199
|
-
interface ITraversable<T extends Type> extends IFunctor<T> {
|
|
200
|
-
get size(): number;
|
|
201
|
-
get isEmpty(): boolean;
|
|
202
|
-
contains(value: T): boolean;
|
|
203
|
-
reduce<U extends T>(f: (acc: U, value: T) => U): U;
|
|
204
|
-
foldLeft<U extends Type>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
205
|
-
foldRight<U extends Type>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
206
|
-
}
|
|
207
|
-
interface ICollection<T extends Type> extends ITraversable<T> {
|
|
208
|
-
add(value: T): ITraversable<T>;
|
|
209
|
-
remove(value: T): ITraversable<T>;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
export { AbstractFunctor, ArrayType, Either, IArrayFunctor, ICollection, IFunctor, IList, IMap, ISet, ITraversable, ITuple, Left, List, Map, None, Option, Right, Set, SingleType, Some, Tuple, Type, left, list, none, option, parseNumber, right, some };
|
|
1
|
+
export { ArrayType, IAbstractFunctor, IArrayFunctor, IFunctor, SingleType, Type } from './functor/index.mjs';
|
|
2
|
+
export { E as Either, I as IIterable, f as IList, g as IMap, b as ISet, k as ITraversable, j as ITry, h as Left, L as List, M as Map, N as None, O as Option, R as Right, a as Seq, c as Set, S as Some, T as Try, i as left, l as list, n as none, o as option, r as right, s as some } from './index-5f972212.js';
|
|
3
|
+
export { ITuple, Tuple } from './tuple/Tuple.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,212 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: L;
|
|
5
|
-
constructor(value: L);
|
|
6
|
-
isLeft(): this is Left<L, R>;
|
|
7
|
-
isRight(): this is Right<L, R>;
|
|
8
|
-
map<U>(_f: (value: R) => U): Either<L, U>;
|
|
9
|
-
flatMap<U>(_f: (value: R) => Either<L, U>): Either<L, U>;
|
|
10
|
-
toOption(): Option<R>;
|
|
11
|
-
toList(): List<R>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
declare class Right<L, R> implements Either<L, R> {
|
|
15
|
-
value: R;
|
|
16
|
-
constructor(value: R);
|
|
17
|
-
isLeft(): this is Left<L, R>;
|
|
18
|
-
isRight(): this is Right<L, R>;
|
|
19
|
-
map<U>(f: (value: R) => U): Either<L, U>;
|
|
20
|
-
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
21
|
-
toOption(): Option<R>;
|
|
22
|
-
toList(): List<R>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface Either<L, R> extends IFunctor<R> {
|
|
26
|
-
value: L | R;
|
|
27
|
-
isLeft(): this is Left<L, R>;
|
|
28
|
-
isRight(): this is Right<L, R>;
|
|
29
|
-
map<U>(f: (value: R) => U): Either<L, U>;
|
|
30
|
-
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
31
|
-
toOption(): Option<R>;
|
|
32
|
-
toList(): List<R>;
|
|
33
|
-
}
|
|
34
|
-
declare const left: <L, R>(value: L) => Either<L, R>;
|
|
35
|
-
declare const right: <L, R>(value: R) => Either<L, R>;
|
|
36
|
-
declare const parseNumber: (input: string) => Either<ParseError, number>;
|
|
37
|
-
|
|
38
|
-
declare class Some<T extends Type> implements Option<T> {
|
|
39
|
-
private value;
|
|
40
|
-
constructor(value: T);
|
|
41
|
-
get isEmpty(): boolean;
|
|
42
|
-
get(): T;
|
|
43
|
-
getOrElse(defaultValue: T): T;
|
|
44
|
-
orElse(alternative: Option<T>): Option<T>;
|
|
45
|
-
map<U extends Type>(f: (value: T) => U): Option<U>;
|
|
46
|
-
flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
|
|
47
|
-
reduce<U>(f: (acc: U, value: T) => U): U;
|
|
48
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
49
|
-
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
50
|
-
toList(): List<T>;
|
|
51
|
-
contains(value: T): boolean;
|
|
52
|
-
get size(): number;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
declare class None<T extends Type> implements Option<T> {
|
|
56
|
-
get isEmpty(): boolean;
|
|
57
|
-
get(): T;
|
|
58
|
-
getOrElse(defaultValue: T): T;
|
|
59
|
-
orElse(alternative: Option<T>): Option<T>;
|
|
60
|
-
map<U extends Type>(f: (value: T) => U): Option<U>;
|
|
61
|
-
flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
|
|
62
|
-
reduce<U>(f: (acc: U, value: T) => U): U;
|
|
63
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
64
|
-
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
65
|
-
toList(): List<T>;
|
|
66
|
-
contains(value: T): boolean;
|
|
67
|
-
get size(): number;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
interface Option<T extends Type> extends IFunctor<T>, ITraversable<T> {
|
|
71
|
-
get(): T;
|
|
72
|
-
getOrElse(defaultValue: T): T;
|
|
73
|
-
orElse(alternative: Option<T>): Option<T>;
|
|
74
|
-
map<U extends Type>(f: (value: T) => U): Option<U>;
|
|
75
|
-
flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
|
|
76
|
-
toList(): List<T>;
|
|
77
|
-
}
|
|
78
|
-
declare const option: <T extends unknown>(value?: T | undefined) => Option<T>;
|
|
79
|
-
declare const some: <T extends unknown>(value: T) => Option<T>;
|
|
80
|
-
declare const none: <T extends unknown>() => Option<T>;
|
|
81
|
-
|
|
82
|
-
declare class List<T> implements IList<T> {
|
|
83
|
-
private readonly items;
|
|
84
|
-
constructor(iterable?: Iterable<T>);
|
|
85
|
-
readonly [n: number]: T;
|
|
86
|
-
remove(value: T): List<T>;
|
|
87
|
-
contains(value: T): boolean;
|
|
88
|
-
get size(): number;
|
|
89
|
-
get isEmpty(): boolean;
|
|
90
|
-
get length(): number;
|
|
91
|
-
add(item: T): List<T>;
|
|
92
|
-
removeAt(index: number): List<T>;
|
|
93
|
-
get(index: number): Option<T>;
|
|
94
|
-
toArray(): readonly T[];
|
|
95
|
-
map<U>(f: (value: T) => U): List<U>;
|
|
96
|
-
flatMap<U>(f: (value: T) => List<U>): List<U>;
|
|
97
|
-
reduce<U>(f: (acc: U, value: T) => U): U;
|
|
98
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
99
|
-
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
100
|
-
concat(other: List<T>): List<T>;
|
|
101
|
-
toString(): string;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
interface IList<T extends Type> extends IFunctor<T>, ICollection<T>, ArrayLike<T> {
|
|
105
|
-
map<U extends Type>(f: (value: T) => U): IList<U>;
|
|
106
|
-
flatMap<U extends Type>(f: (value: T) => IList<U>): IList<U>;
|
|
107
|
-
reduce<U extends Type>(f: (acc: U, value: T) => U): U;
|
|
108
|
-
foldLeft<U extends Type>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
109
|
-
foldRight<U extends Type>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
110
|
-
}
|
|
111
|
-
declare const list: <T extends unknown>(items: T[] | undefined) => List<T>;
|
|
112
|
-
|
|
113
|
-
declare class Tuple<T extends ArrayType> implements ITuple<T> {
|
|
114
|
-
private readonly values;
|
|
115
|
-
constructor(values: T);
|
|
116
|
-
map<U extends ArrayType>(f: (value: T) => U): Tuple<U>;
|
|
117
|
-
flatMap<U extends ArrayType>(f: (value: T) => Tuple<U>): Tuple<U>;
|
|
118
|
-
get(index: number): T[number];
|
|
119
|
-
getAs<U>(index: number, f?: (item: T) => boolean): U;
|
|
120
|
-
toArray(): T;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
interface ITuple<T extends ArrayType> extends IArrayFunctor<T> {
|
|
124
|
-
get(index: number): T[number];
|
|
125
|
-
getAs<U>(index: number, f?: (item: T) => boolean): U;
|
|
126
|
-
map<U extends any[]>(f: (value: T) => U): ITuple<U>;
|
|
127
|
-
flatMap<U extends any[]>(f: (value: T) => ITuple<U>): ITuple<U>;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
declare class Map<K, V> implements IMap<K, V> {
|
|
131
|
-
private internalMap;
|
|
132
|
-
constructor(entries?: [K, V][]);
|
|
133
|
-
add(item: K): Map<K, V>;
|
|
134
|
-
remove(value: ITuple<[K, V]>): Map<K, V>;
|
|
135
|
-
contains(value: ITuple<[K, V]>): boolean;
|
|
136
|
-
get size(): number;
|
|
137
|
-
map<U extends Type>(f: (value: V) => U): IMap<K, U>;
|
|
138
|
-
flatMap<U extends Type>(f: (value: V) => IMap<K, U>): IMap<K, U>;
|
|
139
|
-
reduce<U extends ITuple<[K, V]>>(f: (acc: U, value: ITuple<[K, V]>) => U): U;
|
|
140
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: ITuple<[K, V]>) => U): U;
|
|
141
|
-
foldRight<U>(initialValue: U, f: (value: ITuple<[K, V]>, acc: U) => U): U;
|
|
142
|
-
get(key: K): Option<V>;
|
|
143
|
-
getOrElse(key: K, defaultValue: V): V;
|
|
144
|
-
get isEmpty(): boolean;
|
|
145
|
-
orElse(key: K, alternative: Option<V>): Option<V>;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
interface IMap<K, V> extends IFunctor<ITuple<[K, V]>>, ITraversable<ITuple<[K, V]>> {
|
|
149
|
-
map<U>(f: (value: any) => U): IMap<K, U>;
|
|
150
|
-
flatMap<U>(f: (value: any) => IMap<K, U>): IMap<K, U>;
|
|
151
|
-
reduce<U extends ITuple<[K, V]>>(f: (acc: U, value: ITuple<[K, V]>) => U): U;
|
|
152
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: ITuple<[K, V]>) => U): U;
|
|
153
|
-
foldRight<U>(initialValue: U, f: (value: ITuple<[K, V]>, acc: U) => U): U;
|
|
154
|
-
get(key: K): Option<V>;
|
|
155
|
-
getOrElse(key: K, defaultValue: V): V;
|
|
156
|
-
orElse(key: K, alternative: Option<V>): Option<V>;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
declare class Set<T> implements ISet<T>, ICollection<T> {
|
|
160
|
-
private readonly internalSet;
|
|
161
|
-
constructor(iterable?: Iterable<T>);
|
|
162
|
-
add(value: T): Set<T>;
|
|
163
|
-
remove(value: T): Set<T>;
|
|
164
|
-
contains(value: T): boolean;
|
|
165
|
-
get size(): number;
|
|
166
|
-
get isEmpty(): boolean;
|
|
167
|
-
map<U>(f: (value: T) => U): ISet<U>;
|
|
168
|
-
flatMap<U>(f: (value: T) => ISet<U>): ISet<U>;
|
|
169
|
-
reduce<U>(f: (acc: U, value: T) => U): U;
|
|
170
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
171
|
-
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
172
|
-
has(value: T): boolean;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
interface ISet<T> extends IFunctor<T> {
|
|
176
|
-
map<U>(f: (value: T) => U): ISet<U>;
|
|
177
|
-
flatMap<U>(f: (value: T) => ISet<U>): ISet<U>;
|
|
178
|
-
reduce<U>(f: (acc: U, value: T) => U): U;
|
|
179
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
180
|
-
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
181
|
-
has(value: T): boolean;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
type SingleType = any;
|
|
185
|
-
type ArrayType = SingleType[];
|
|
186
|
-
type Type = SingleType | ArrayType;
|
|
187
|
-
interface AbstractFunctor<T extends Type> {
|
|
188
|
-
map(f: (value: T) => Type): AbstractFunctor<Type>;
|
|
189
|
-
flatMap(f: (value: T) => AbstractFunctor<Type>): AbstractFunctor<Type>;
|
|
190
|
-
}
|
|
191
|
-
interface IFunctor<T extends Type> extends AbstractFunctor<T> {
|
|
192
|
-
map<U extends Type>(f: (value: T) => U): IFunctor<U>;
|
|
193
|
-
flatMap<U extends Type>(f: (value: T) => IFunctor<U>): IFunctor<U>;
|
|
194
|
-
}
|
|
195
|
-
interface IArrayFunctor<T extends ArrayType> extends AbstractFunctor<T> {
|
|
196
|
-
map<U extends ArrayType>(f: (value: T) => U): IArrayFunctor<U>;
|
|
197
|
-
flatMap<U extends ArrayType>(f: (value: T) => IArrayFunctor<U>): IArrayFunctor<U>;
|
|
198
|
-
}
|
|
199
|
-
interface ITraversable<T extends Type> extends IFunctor<T> {
|
|
200
|
-
get size(): number;
|
|
201
|
-
get isEmpty(): boolean;
|
|
202
|
-
contains(value: T): boolean;
|
|
203
|
-
reduce<U extends T>(f: (acc: U, value: T) => U): U;
|
|
204
|
-
foldLeft<U extends Type>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
205
|
-
foldRight<U extends Type>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
206
|
-
}
|
|
207
|
-
interface ICollection<T extends Type> extends ITraversable<T> {
|
|
208
|
-
add(value: T): ITraversable<T>;
|
|
209
|
-
remove(value: T): ITraversable<T>;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
export { AbstractFunctor, ArrayType, Either, IArrayFunctor, ICollection, IFunctor, IList, IMap, ISet, ITraversable, ITuple, Left, List, Map, None, Option, Right, Set, SingleType, Some, Tuple, Type, left, list, none, option, parseNumber, right, some };
|
|
1
|
+
export { ArrayType, IAbstractFunctor, IArrayFunctor, IFunctor, SingleType, Type } from './functor/index.js';
|
|
2
|
+
export { E as Either, I as IIterable, f as IList, g as IMap, b as ISet, k as ITraversable, j as ITry, h as Left, L as List, M as Map, N as None, O as Option, R as Right, a as Seq, c as Set, S as Some, T as Try, i as left, l as list, n as none, o as option, r as right, s as some } from './index-3866f956.js';
|
|
3
|
+
export { ITuple, Tuple } from './tuple/Tuple.js';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-6BEXQNLZ.js');var _chunk3RJPXVXEjs = require('./chunk-3RJPXVXE.js');require('./chunk-ZOH672YH.js');var _chunk5DQWEDA3js = require('./chunk-5DQWEDA3.js');require('./chunk-TVZBBVEV.js');var _chunkFQY6BMNGjs = require('./chunk-FQY6BMNG.js');require('./chunk-5VTXJIR3.js');var _chunkBYPZZZTGjs = require('./chunk-BYPZZZTG.js');var _chunkBFK2RZ2Zjs = require('./chunk-BFK2RZ2Z.js');var _chunkSDHW57XQjs = require('./chunk-SDHW57XQ.js');require('./chunk-3VJERXBP.js');require('./chunk-XORABVON.js');require('./chunk-XVHCBGUW.js');var _chunkZTTAUZK3js = require('./chunk-ZTTAUZK3.js');require('./chunk-BNNK42JC.js');require('./chunk-VTKL7OQI.js');exports.Left = _chunkBFK2RZ2Zjs.b; exports.List = _chunkSDHW57XQjs.b; exports.Map = _chunk5DQWEDA3js.a; exports.None = _chunkZTTAUZK3js.b; exports.Right = _chunkBFK2RZ2Zjs.a; exports.Seq = _chunkZTTAUZK3js.f; exports.Set = _chunkSDHW57XQjs.a; exports.Some = _chunkZTTAUZK3js.a; exports.Try = _chunk3RJPXVXEjs.a; exports.Tuple = _chunkFQY6BMNGjs.a; exports.left = _chunkBYPZZZTGjs.a; exports.list = _chunkSDHW57XQjs.c; exports.none = _chunkZTTAUZK3js.e; exports.option = _chunkZTTAUZK3js.c; exports.right = _chunkBYPZZZTGjs.b; exports.some = _chunkZTTAUZK3js.d;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import"./chunk-Q4H3PCBH.mjs";import{a as d}from"./chunk-TAJ6OYCN.mjs";import"./chunk-3OHJLCSR.mjs";import{a as n}from"./chunk-DP5G2LT6.mjs";import"./chunk-LBQXRIXP.mjs";import{a}from"./chunk-RMQF6I4T.mjs";import"./chunk-377WQNCB.mjs";import{a as i,b as c}from"./chunk-DFWZ7ANA.mjs";import{a as B,b}from"./chunk-LGUIG2RX.mjs";import{a as m,b as A,c as x}from"./chunk-6RUUD24R.mjs";import"./chunk-HA5XD5KC.mjs";import"./chunk-V2J3R5IU.mjs";import"./chunk-74TKYQJS.mjs";import{a as e,b as o,c as r,d as t,e as f,f as p}from"./chunk-X52Z6M5P.mjs";import"./chunk-RRAIFS3D.mjs";import"./chunk-U5EUM74A.mjs";export{b as Left,A as List,n as Map,o as None,B as Right,p as Seq,m as Set,e as Some,d as Try,a as Tuple,i as left,x as list,f as none,r as option,c as right,t as some};
|