functype 0.2.1 → 0.4.0
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-2XH6TPQK.mjs +1 -0
- package/dist/chunk-4P46BMZQ.js +1 -0
- package/dist/chunk-7JTQ2BTE.mjs +1 -0
- package/dist/chunk-CPB6NX2S.js +1 -0
- package/dist/chunk-GZIDEEAG.mjs +1 -0
- package/dist/chunk-HF33BEHO.js +1 -0
- package/dist/chunk-LLZGG3YT.js +1 -0
- package/dist/{chunk-ZTTAUZK3.js → chunk-LO5XBCIY.js} +1 -1
- package/dist/chunk-OLJYBLCT.js +1 -0
- package/dist/{chunk-LGUIG2RX.mjs → chunk-S5YAJ7CP.mjs} +1 -1
- package/dist/chunk-SPNWCOGV.mjs +1 -0
- package/dist/chunk-UVR6IELR.mjs +1 -0
- package/dist/chunk-V5UFW2E4.js +1 -0
- package/dist/{chunk-X52Z6M5P.mjs → chunk-WMSIRQ3W.mjs} +1 -1
- package/dist/collections/index.d.mts +1 -1
- package/dist/collections/index.d.ts +1 -1
- package/dist/either/Either.d.mts +1 -1
- package/dist/either/Either.d.ts +1 -1
- package/dist/either/Either.js +1 -1
- package/dist/either/Either.mjs +1 -1
- package/dist/either/index.d.mts +1 -1
- package/dist/either/index.d.ts +1 -1
- package/dist/either/index.js +1 -1
- package/dist/either/index.mjs +1 -1
- package/dist/error/ParseError.js +1 -1
- package/dist/error/ParseError.mjs +1 -1
- package/dist/functor/index.d.mts +13 -13
- package/dist/functor/index.d.ts +13 -13
- package/dist/index-BSx1ncJ9.d.ts +231 -0
- package/dist/index-uP_Hoh2D.d.mts +231 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/iterable/Seq.d.mts +1 -1
- package/dist/iterable/Seq.d.ts +1 -1
- package/dist/iterable/Seq.js +1 -1
- package/dist/iterable/Seq.mjs +1 -1
- package/dist/iterable/index.d.mts +1 -1
- package/dist/iterable/index.d.ts +1 -1
- package/dist/iterable/index.js +1 -1
- package/dist/iterable/index.mjs +1 -1
- package/dist/list/List.d.mts +1 -1
- package/dist/list/List.d.ts +1 -1
- package/dist/list/List.js +1 -1
- package/dist/list/List.mjs +1 -1
- package/dist/list/index.d.mts +1 -1
- package/dist/list/index.d.ts +1 -1
- package/dist/list/index.js +1 -1
- package/dist/list/index.mjs +1 -1
- package/dist/map/Map.d.mts +1 -1
- package/dist/map/Map.d.ts +1 -1
- package/dist/map/Map.js +1 -1
- package/dist/map/Map.mjs +1 -1
- package/dist/map/index.d.mts +1 -1
- package/dist/map/index.d.ts +1 -1
- package/dist/map/index.js +1 -1
- package/dist/map/index.mjs +1 -1
- package/dist/map/shim.d.mts +1 -1
- package/dist/map/shim.d.ts +1 -1
- package/dist/map/shim.js +1 -1
- package/dist/map/shim.mjs +1 -1
- package/dist/option/Option.d.mts +1 -1
- package/dist/option/Option.d.ts +1 -1
- package/dist/option/Option.js +1 -1
- package/dist/option/Option.mjs +1 -1
- package/dist/option/index.d.mts +1 -1
- package/dist/option/index.d.ts +1 -1
- package/dist/option/index.js +1 -1
- package/dist/option/index.mjs +1 -1
- package/dist/set/Set.d.mts +1 -1
- package/dist/set/Set.d.ts +1 -1
- package/dist/set/Set.js +1 -1
- package/dist/set/Set.mjs +1 -1
- package/dist/set/index.d.mts +1 -1
- package/dist/set/index.d.ts +1 -1
- package/dist/set/index.js +1 -1
- package/dist/set/index.mjs +1 -1
- package/dist/set/shim.d.mts +1 -1
- package/dist/set/shim.d.ts +1 -1
- package/dist/set/shim.js +1 -1
- package/dist/set/shim.mjs +1 -1
- package/dist/try/Try.d.mts +1 -1
- package/dist/try/Try.d.ts +1 -1
- package/dist/try/Try.js +1 -1
- package/dist/try/Try.mjs +1 -1
- package/dist/try/index.d.mts +1 -1
- package/dist/try/index.d.ts +1 -1
- package/dist/try/index.js +1 -1
- package/dist/try/index.mjs +1 -1
- package/dist/tuple/Tuple.d.mts +7 -7
- package/dist/tuple/Tuple.d.ts +7 -7
- package/dist/tuple/Tuple.js +1 -1
- package/dist/tuple/Tuple.mjs +1 -1
- package/dist/tuple/index.d.mts +1 -1
- package/dist/tuple/index.d.ts +1 -1
- package/dist/tuple/index.js +1 -1
- package/dist/tuple/index.mjs +1 -1
- package/dist/util/index.d.mts +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.js +1 -1
- package/dist/util/index.mjs +1 -1
- package/dist/util/isIterable.js +1 -1
- package/dist/util/isIterable.mjs +1 -1
- package/package.json +17 -17
- package/dist/chunk-3RJPXVXE.js +0 -1
- package/dist/chunk-5DQWEDA3.js +0 -1
- package/dist/chunk-6RUUD24R.mjs +0 -1
- package/dist/chunk-BFK2RZ2Z.js +0 -1
- package/dist/chunk-BYPZZZTG.js +0 -1
- package/dist/chunk-DFWZ7ANA.mjs +0 -1
- package/dist/chunk-DP5G2LT6.mjs +0 -1
- package/dist/chunk-FQY6BMNG.js +0 -1
- package/dist/chunk-RMQF6I4T.mjs +0 -1
- package/dist/chunk-SDHW57XQ.js +0 -1
- package/dist/chunk-TAJ6OYCN.mjs +0 -1
- package/dist/index-3866f956.d.ts +0 -227
- package/dist/index-5f972212.d.ts +0 -227
- /package/dist/{chunk-VTKL7OQI.js → chunk-D22QKJZO.js} +0 -0
- /package/dist/{chunk-U5EUM74A.mjs → chunk-U37JTC3U.mjs} +0 -0
package/dist/index-5f972212.d.ts
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
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 };
|
|
File without changes
|
|
File without changes
|