functype 0.45.0 → 0.46.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/Companion-VlxcFhzb.js +1 -0
- package/dist/{index-DBg23xHh.d.ts → Functype-Dc440LS5.d.ts} +202 -1035
- package/dist/{Tuple-35L0I92q.d.ts → Typeable-E4-aX9Gc.d.ts} +1 -74
- package/dist/Valuable-B8h0iKI_.js +13 -0
- package/dist/branded/index.d.ts +53 -1
- package/dist/branded/index.js +1 -1
- package/dist/cli/index.js +37 -7
- package/dist/do/index.d.ts +184 -2
- package/dist/do/index.js +1 -1
- package/dist/either/index.d.ts +187 -1
- package/dist/either/index.js +2 -1
- package/dist/index.d.ts +12 -4
- package/dist/index.js +1 -1
- package/dist/list/index.d.ts +84 -1
- package/dist/list/index.js +2 -1
- package/dist/map/index.d.ts +71 -1
- package/dist/map/index.js +2 -1
- package/dist/option/index.d.ts +242 -1
- package/dist/option/index.js +2 -1
- package/dist/set/index.d.ts +53 -1
- package/dist/set/index.js +2 -1
- package/dist/try/index.d.ts +96 -1
- package/dist/try/index.js +2 -1
- package/dist/tuple/index.d.ts +75 -1
- package/dist/tuple/index.js +1 -1
- package/package.json +7 -7
- package/dist/Brand-B_uQBKwR.d.ts +0 -54
- package/dist/Brand-DxglW-qB.js +0 -1
- package/dist/Tuple-BQLc_Ion.js +0 -1
- package/dist/src-Bl2PmAVK.js +0 -19
package/dist/option/index.d.ts
CHANGED
|
@@ -1,2 +1,243 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mn as Doable, nn as Reshapeable, rn as Promisable, t as Functype } from "../Functype-Dc440LS5.js";
|
|
2
|
+
import { l as Type } from "../Typeable-E4-aX9Gc.js";
|
|
3
|
+
import { List } from "../list/index.js";
|
|
4
|
+
import { Either } from "../either/index.js";
|
|
5
|
+
|
|
6
|
+
//#region src/option/Option.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Option type module
|
|
9
|
+
* @module Option
|
|
10
|
+
* @category Core
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The Option type represents a value that may or may not exist.
|
|
14
|
+
* It's used to handle potentially null or undefined values in a type-safe way.
|
|
15
|
+
* @typeParam T - The type of the value contained in the Option
|
|
16
|
+
*/
|
|
17
|
+
interface Option<T extends Type> extends Functype<T, "Some" | "None">, Promisable<T>, Doable<T>, Reshapeable<T> {
|
|
18
|
+
/** The contained value (undefined for None) */
|
|
19
|
+
readonly value: T | undefined;
|
|
20
|
+
/** Whether this Option contains no value */
|
|
21
|
+
isEmpty: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Returns true if this Option is a Some (contains a value)
|
|
24
|
+
* @returns true if this Option contains a value, false otherwise
|
|
25
|
+
*/
|
|
26
|
+
isSome(): this is Option<T> & {
|
|
27
|
+
value: T;
|
|
28
|
+
isEmpty: false;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Returns true if this Option is a None (contains no value)
|
|
32
|
+
* @returns true if this Option is empty, false otherwise
|
|
33
|
+
*/
|
|
34
|
+
isNone(): this is Option<T> & {
|
|
35
|
+
value: undefined;
|
|
36
|
+
isEmpty: true;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Returns the contained value or a default value if None
|
|
40
|
+
* @param defaultValue - The value to return if this Option is None
|
|
41
|
+
* @returns The contained value or defaultValue
|
|
42
|
+
*/
|
|
43
|
+
orElse(defaultValue: T): T;
|
|
44
|
+
/**
|
|
45
|
+
* Returns the contained value or throws an error if None
|
|
46
|
+
* @param error - Optional custom error to throw. If not provided, throws a default error
|
|
47
|
+
* @returns The contained value
|
|
48
|
+
* @throws The specified error or a default error if the Option is None
|
|
49
|
+
*/
|
|
50
|
+
orThrow(error?: Error): T;
|
|
51
|
+
/**
|
|
52
|
+
* Returns this Option if it contains a value, otherwise returns the alternative container
|
|
53
|
+
* @param alternative - The alternative Option to return if this is None
|
|
54
|
+
* @returns This Option or the alternative
|
|
55
|
+
*/
|
|
56
|
+
or(alternative: Option<T>): Option<T>;
|
|
57
|
+
/**
|
|
58
|
+
* Returns the contained value or null if None
|
|
59
|
+
* @returns The contained value or null
|
|
60
|
+
*/
|
|
61
|
+
orNull(): T | null;
|
|
62
|
+
/**
|
|
63
|
+
* Returns the contained value or undefined if None
|
|
64
|
+
* @returns The contained value or undefined
|
|
65
|
+
*/
|
|
66
|
+
orUndefined(): T | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Maps the value inside the Option using the provided function
|
|
69
|
+
* @param f - The mapping function
|
|
70
|
+
* @returns A new Option containing the mapped value, or None if this Option is None
|
|
71
|
+
*/
|
|
72
|
+
map<U extends Type>(f: (value: T) => U): Option<U>;
|
|
73
|
+
/**
|
|
74
|
+
* Applies a wrapped function to a wrapped value (Applicative pattern)
|
|
75
|
+
* @param ff - An Option containing a function from T to U
|
|
76
|
+
* @returns A new Option containing the result of applying the function
|
|
77
|
+
*/
|
|
78
|
+
ap<U extends Type>(ff: Option<(value: T) => U>): Option<U>;
|
|
79
|
+
/**
|
|
80
|
+
* Returns this Option if it contains a value that satisfies the predicate, otherwise returns None
|
|
81
|
+
* @param predicate - The predicate function to test the value
|
|
82
|
+
* @returns This Option or None
|
|
83
|
+
*/
|
|
84
|
+
filter(predicate: (value: T) => boolean): Option<T>;
|
|
85
|
+
/**
|
|
86
|
+
* Maps the value using a function that returns an Option
|
|
87
|
+
* @param f - The mapping function returning an Option
|
|
88
|
+
* @returns The result of applying f to the contained value, or None if this Option is None
|
|
89
|
+
*/
|
|
90
|
+
flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
|
|
91
|
+
/**
|
|
92
|
+
* Maps the value using an async function that returns an Option
|
|
93
|
+
* @param f - The async mapping function returning an Option
|
|
94
|
+
* @returns Promise of the result of applying f to the contained value, or None if this Option is None
|
|
95
|
+
*/
|
|
96
|
+
flatMapAsync<U extends Type>(f: (value: T) => Promise<Option<U>>): Promise<Option<U>>;
|
|
97
|
+
/**
|
|
98
|
+
* Applies a binary operator to a start value and the contained value
|
|
99
|
+
* @param f - The binary operator
|
|
100
|
+
* @returns The result of the reduction
|
|
101
|
+
*/
|
|
102
|
+
reduce<U>(f: (acc: U, value: T) => U): U;
|
|
103
|
+
/**
|
|
104
|
+
* Applies a binary operator to the contained value and a start value
|
|
105
|
+
* @param f - The binary operator
|
|
106
|
+
* @returns The result of the reduction
|
|
107
|
+
*/
|
|
108
|
+
reduceRight<U>(f: (acc: U, value: T) => U): U;
|
|
109
|
+
/**
|
|
110
|
+
* Pattern matches over the Option, applying onNone if None and onSome if Some
|
|
111
|
+
* @param onNone - Function to apply if the Option is None
|
|
112
|
+
* @param onSome - Function to apply if the Option has a value
|
|
113
|
+
* @returns The result of applying the appropriate function
|
|
114
|
+
*/
|
|
115
|
+
fold<U>(onNone: () => U, onSome: (value: T) => U): U;
|
|
116
|
+
/**
|
|
117
|
+
* Left-associative fold using the provided zero value and operation
|
|
118
|
+
* @param z - Zero/identity value
|
|
119
|
+
* @returns A function that takes an operation to apply
|
|
120
|
+
*/
|
|
121
|
+
foldLeft<B>(z: B): (op: (b: B, a: T) => B) => B;
|
|
122
|
+
/**
|
|
123
|
+
* Right-associative fold using the provided zero value and operation
|
|
124
|
+
* @param z - Zero/identity value
|
|
125
|
+
* @returns A function that takes an operation to apply
|
|
126
|
+
*/
|
|
127
|
+
foldRight<B>(z: B): (op: (a: T, b: B) => B) => B;
|
|
128
|
+
/**
|
|
129
|
+
* Converts this Option to a List
|
|
130
|
+
* @returns A List containing the value if Some, or empty List if None
|
|
131
|
+
*/
|
|
132
|
+
toList(): List<T>;
|
|
133
|
+
/**
|
|
134
|
+
* Checks if this Option contains the specified value
|
|
135
|
+
* @param value - The value to check for
|
|
136
|
+
* @returns true if this Option contains the value, false otherwise
|
|
137
|
+
*/
|
|
138
|
+
contains(value: T): boolean;
|
|
139
|
+
/** The number of elements in this Option (0 or 1) */
|
|
140
|
+
size: number;
|
|
141
|
+
/**
|
|
142
|
+
* Converts this Option to an Either
|
|
143
|
+
* @param left - The value to use for Left if this Option is None
|
|
144
|
+
* @returns Either.Right with the contained value if Some, or Either.Left with left if None
|
|
145
|
+
*/
|
|
146
|
+
toEither<E>(left: E): Either<E, T>;
|
|
147
|
+
/**
|
|
148
|
+
* Returns a string representation of this Option
|
|
149
|
+
* @returns A string representation
|
|
150
|
+
*/
|
|
151
|
+
toString(): string;
|
|
152
|
+
/**
|
|
153
|
+
* Returns a simple object representation of this Option
|
|
154
|
+
* @returns An object with _tag and value properties
|
|
155
|
+
*/
|
|
156
|
+
toValue(): {
|
|
157
|
+
_tag: "Some" | "None";
|
|
158
|
+
value: T;
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Pattern matches over the Option, applying a handler function based on the variant
|
|
162
|
+
* @param patterns - Object with handler functions for Some and None variants
|
|
163
|
+
* @returns The result of applying the matching handler function
|
|
164
|
+
*/
|
|
165
|
+
match<R>(patterns: {
|
|
166
|
+
Some: (value: T) => R;
|
|
167
|
+
None: () => R;
|
|
168
|
+
}): R;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Creates a Some variant of Option containing a value.
|
|
172
|
+
* @param value - The value to wrap in Some
|
|
173
|
+
* @returns A new Some instance containing the value
|
|
174
|
+
* @typeParam T - The type of the value
|
|
175
|
+
*/
|
|
176
|
+
declare const Some: <T extends Type>(value: T) => Option<T>;
|
|
177
|
+
/**
|
|
178
|
+
* Creates a None variant of Option representing absence of a value.
|
|
179
|
+
* @returns A new None instance
|
|
180
|
+
* @typeParam T - The type that would be contained if this was a Some
|
|
181
|
+
*/
|
|
182
|
+
declare const None: <T extends Type>() => Option<T>;
|
|
183
|
+
/**
|
|
184
|
+
* Safely wraps a value that might be null or undefined in an Option.
|
|
185
|
+
* Creates Some if the value is defined, None otherwise.
|
|
186
|
+
* @param value - The value to wrap (might be null/undefined)
|
|
187
|
+
* @returns Some(value) if value is defined, None otherwise
|
|
188
|
+
* @typeParam T - The type of the value
|
|
189
|
+
*/
|
|
190
|
+
declare const OptionConstructor: <T extends Type>(value: T | null | undefined) => Option<T>;
|
|
191
|
+
declare const Option: (<T extends Type>(value: T | null | undefined) => Option<T>) & {
|
|
192
|
+
/**
|
|
193
|
+
* Creates an Option from any value. Alias for Option function.
|
|
194
|
+
* @param value - The value to wrap
|
|
195
|
+
* @returns Some(value) if value is defined, None otherwise
|
|
196
|
+
* @typeParam T - The type of the value
|
|
197
|
+
*/
|
|
198
|
+
from: <T>(value: T) => Option<T>;
|
|
199
|
+
/**
|
|
200
|
+
* Returns a None instance. Alias for None function.
|
|
201
|
+
* @returns A None instance
|
|
202
|
+
* @typeParam T - The type that would be contained if this was a Some
|
|
203
|
+
*/
|
|
204
|
+
none: <T>() => Option<T>;
|
|
205
|
+
/**
|
|
206
|
+
* Type guard to check if an Option is Some
|
|
207
|
+
* @param option - The Option to check
|
|
208
|
+
* @returns True if Option is Some
|
|
209
|
+
*/
|
|
210
|
+
isSome: <T>(option: Option<T>) => option is Option<T> & {
|
|
211
|
+
value: T;
|
|
212
|
+
isEmpty: false;
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Type guard to check if an Option is None
|
|
216
|
+
* @param option - The Option to check
|
|
217
|
+
* @returns True if Option is None
|
|
218
|
+
*/
|
|
219
|
+
isNone: <T>(option: Option<T>) => option is Option<T> & {
|
|
220
|
+
value: undefined;
|
|
221
|
+
isEmpty: true;
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Creates an Option from JSON string
|
|
225
|
+
* @param json - The JSON string
|
|
226
|
+
* @returns Option instance
|
|
227
|
+
*/
|
|
228
|
+
fromJSON: <T>(json: string) => Option<T>;
|
|
229
|
+
/**
|
|
230
|
+
* Creates an Option from YAML string
|
|
231
|
+
* @param yaml - The YAML string
|
|
232
|
+
* @returns Option instance
|
|
233
|
+
*/
|
|
234
|
+
fromYAML: <T>(yaml: string) => Option<T>;
|
|
235
|
+
/**
|
|
236
|
+
* Creates an Option from binary string
|
|
237
|
+
* @param binary - The binary string
|
|
238
|
+
* @returns Option instance
|
|
239
|
+
*/
|
|
240
|
+
fromBinary: <T>(binary: string) => Option<T>;
|
|
241
|
+
};
|
|
242
|
+
//#endregion
|
|
2
243
|
export { None, Option, OptionConstructor, Some };
|
package/dist/option/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{rt as e}from"../Valuable-B8h0iKI_.js";import{t}from"../Companion-VlxcFhzb.js";import{Try as n}from"../try/index.js";import{List as r}from"../list/index.js";import{Left as i,Right as a}from"../either/index.js";import o from"safe-stable-stringify";const s=t=>({_tag:`Some`,value:t,isEmpty:!1,isSome(){return!0},isNone(){return!1},orElse:()=>t,orThrow:()=>t,or:e=>s(t),orNull:()=>t,orUndefined:()=>t,map:e=>s(e(t)),ap:e=>e._tag===`Some`&&e.value?s(e.value(t)):c,filter(e){return e(t)?s(t):c},count:e=>e(t)?1:0,find:e=>e(t)?s(t):c,exists:e=>e(t),forEach:e=>e(t),fold:(e,n)=>n(t),match:e=>e.Some(t),flatMap:e=>e(t),flatMapAsync:async e=>await e(t),reduce:e=>e(void 0,t),reduceRight:e=>e(void 0,t),foldLeft:e=>n=>n(e,t),foldRight:e=>n=>n(t,e),toList:()=>r([t]),contains:e=>e===t,size:1,toOption:()=>s(t),toEither:e=>a(t),toTry:()=>n(()=>t),toPromise:()=>Promise.resolve(t),toString:()=>`Some(${o(t)})`,toValue:()=>({_tag:`Some`,value:t}),pipe:e=>e(t),serialize:()=>e(`Some`,t),doUnwrap(){return{ok:!0,value:t}}}),c={_tag:`None`,value:void 0,isEmpty:!0,isSome(){return!1},isNone(){return!0},orElse:e=>e,orThrow(e){throw e??Error(`Cannot extract value from None`)},or:e=>e,orNull:()=>null,orUndefined:()=>void 0,map:e=>c,ap:e=>c,filter(e){return c},count:e=>0,find:e=>c,exists:e=>!1,forEach:e=>{},flatMap:e=>c,flatMapAsync:e=>Promise.resolve(c),reduce:()=>void 0,reduceRight:()=>void 0,fold:(e,t)=>e(),match:e=>e.None(),foldLeft:e=>()=>e,foldRight:e=>()=>e,toList:()=>r([]),contains:()=>!1,size:0,toOption:()=>c,toEither:e=>i(e),toTry:()=>n(()=>{throw Error(`None`)}),toPromise:()=>Promise.reject(Error(`Cannot convert None to Promise`)),toString:()=>`None`,toValue:()=>({_tag:`None`,value:void 0}),pipe:e=>e(void 0),serialize:()=>e(`None`,null),doUnwrap(){return{ok:!1,empty:!0}}},l=()=>c,u=e=>e==null?l():s(e),d={from:e=>f(e),none:()=>l(),isSome:e=>e.isSome(),isNone:e=>e.isNone(),fromJSON:e=>{let t=JSON.parse(e);return t._tag===`Some`?s(t.value):l()},fromYAML:e=>{let t=e.split(`
|
|
2
|
+
`),n=t[0]?.split(`: `)[1],r=t[1]?.split(`: `)[1];if(!n||!r)return l();let i=r===`null`?null:JSON.parse(r);return n===`Some`?s(i):l()},fromBinary:e=>{let t=Buffer.from(e,`base64`).toString();return d.fromJSON(t)}},f=t(u,d);export{l as None,f as Option,u as OptionConstructor,s as Some};
|
package/dist/set/index.d.ts
CHANGED
|
@@ -1,2 +1,54 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as Collection, r as FunctypeCollection } from "../Functype-Dc440LS5.js";
|
|
2
|
+
import { l as Type } from "../Typeable-E4-aX9Gc.js";
|
|
3
|
+
import { List } from "../list/index.js";
|
|
4
|
+
|
|
5
|
+
//#region src/set/Set.d.ts
|
|
6
|
+
interface Set<A> extends FunctypeCollection<A, "Set">, Collection<A> {
|
|
7
|
+
add: (value: A) => Set<A>;
|
|
8
|
+
remove: (value: A) => Set<A>;
|
|
9
|
+
contains: (value: A) => boolean;
|
|
10
|
+
has: (value: A) => boolean;
|
|
11
|
+
map: <B>(f: (a: A) => B) => Set<B>;
|
|
12
|
+
flatMap: <B>(f: (a: A) => Iterable<B>) => Set<B>;
|
|
13
|
+
filter: (p: (a: A) => boolean) => Set<A>;
|
|
14
|
+
filterNot: (p: (a: A) => boolean) => Set<A>;
|
|
15
|
+
fold: <U extends Type>(onEmpty: () => U, onValue: (value: A) => U) => U;
|
|
16
|
+
toList: () => List<A>;
|
|
17
|
+
toSet: () => Set<A>;
|
|
18
|
+
toArray: <B = A>() => B[];
|
|
19
|
+
toString: () => string;
|
|
20
|
+
}
|
|
21
|
+
declare const Set: (<A>(iterable?: Iterable<A>) => Set<A>) & {
|
|
22
|
+
/**
|
|
23
|
+
* Creates an empty Set
|
|
24
|
+
* Returns a singleton instance for efficiency
|
|
25
|
+
* @returns An empty Set instance
|
|
26
|
+
*/
|
|
27
|
+
empty: <A extends Type>() => Set<A>;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a Set from variadic arguments
|
|
30
|
+
* @param values - Values to create set from
|
|
31
|
+
* @returns A Set containing the unique values
|
|
32
|
+
*/
|
|
33
|
+
of: <A extends Type>(...values: A[]) => Set<A>;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a Set from JSON string
|
|
36
|
+
* @param json - The JSON string
|
|
37
|
+
* @returns Set instance
|
|
38
|
+
*/
|
|
39
|
+
fromJSON: <A>(json: string) => Set<A>;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a Set from YAML string
|
|
42
|
+
* @param yaml - The YAML string
|
|
43
|
+
* @returns Set instance
|
|
44
|
+
*/
|
|
45
|
+
fromYAML: <A>(yaml: string) => Set<A>;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a Set from binary string
|
|
48
|
+
* @param binary - The binary string
|
|
49
|
+
* @returns Set instance
|
|
50
|
+
*/
|
|
51
|
+
fromBinary: <A>(binary: string) => Set<A>;
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
2
54
|
export { Set };
|
package/dist/set/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{et as e,rt as t}from"../Valuable-B8h0iKI_.js";import{t as n}from"../Companion-VlxcFhzb.js";import{Option as r}from"../option/index.js";import{List as i}from"../list/index.js";const a=n=>{let o=new e(n),s={_tag:`Set`,[Symbol.iterator]:()=>o[Symbol.iterator](),add:e=>a([...o,e]),remove:t=>{let n=new e(o);return n.delete(t),a(n)},contains:e=>o.has(e),has:e=>o.has(e),map:e=>a(Array.from(o).map(e)),ap:t=>{let n=new e;for(let e of o)for(let r of t)n.add(r(e));return a(n)},flatMap:t=>{let n=new e;for(let e of o)for(let r of t(e))n.add(r);return a(n)},flatMapAsync:async t=>{let n=new e;for(let e of o){let r=await t(e);for(let e of r)n.add(e)}return a(n)},fold:(e,t)=>{if(o.size===0)return e();let n=Array.from(o);if(n.length===0)return e();let r=n[0];return r===void 0?e():t(r)},foldLeft:e=>t=>{let n=e;for(let e of o)n=t(n,e);return n},foldRight:e=>t=>Array.from(o).reduceRight((e,n)=>t(n,e),e),get size(){return o.size},get isEmpty(){return o.size===0},reduce:e=>{let t=Array.from(o);if(t.length===0)throw Error(`Cannot reduce empty Set`);return t.reduce(e)},reduceRight:e=>{let t=Array.from(o);if(t.length===0)throw Error(`Cannot reduceRight empty Set`);return t.reduceRight(e)},count:e=>{let t=0;for(let n of o)e(n)&&t++;return t},find:e=>{for(let t of o)if(e(t))return r(t);return r(null)},exists:e=>{for(let t of o)if(e(t))return!0;return!1},forEach:e=>{o.forEach(e)},filter:t=>{let n=new e;for(let e of o)t(e)&&n.add(e);return a(n)},filterNot:t=>{let n=new e;for(let e of o)t(e)||n.add(e);return a(n)},drop:e=>a(Array.from(o).slice(e)),dropRight:e=>a(Array.from(o).slice(0,-e)),dropWhile:e=>{let t=Array.from(o),n=t.findIndex(t=>!e(t));return a(n===-1?[]:t.slice(n))},flatten:()=>{let t=new e;for(let e of o)if(Array.isArray(e))for(let n of e)t.add(n);else if(e&&typeof e==`object`&&Symbol.iterator in e)for(let n of e)t.add(n);else t.add(e);return a(t)},get head(){return Array.from(o)[0]},get headOption(){let e=Array.from(o)[0];return r(e)},take:e=>a(Array.from(o).slice(0,Math.max(0,e))),takeWhile:e=>{let t=Array.from(o),n=[];for(let r of t){if(!e(r))break;n.push(r)}return a(n)},takeRight:e=>{let t=Array.from(o);return a(e<=0?[]:t.slice(-e))},get last(){let e=Array.from(o);return e[e.length-1]},get lastOption(){let e=Array.from(o);return r(e[e.length-1])},get tail(){return a(Array.from(o).slice(1))},get init(){let e=Array.from(o);return a(e.length===0?[]:e.slice(0,-1))},toList:()=>i(Array.from(o)),toSet:()=>s,toArray:()=>Array.from(o),toString:()=>`Set(${Array.from(o).toString()})`,toValue:()=>({_tag:`Set`,value:Array.from(o)}),pipe:e=>e(Array.from(o)),serialize:()=>t(`Set`,Array.from(o))};return s},o=e=>a(e),s=a([]),c={empty:()=>s,of:(...e)=>a(e),fromJSON:e=>l(JSON.parse(e).value),fromYAML:e=>{let t=e.split(`
|
|
2
|
+
`)[1]?.split(`: `)[1];return l(t?JSON.parse(t):[])},fromBinary:e=>{let t=Buffer.from(e,`base64`).toString();return c.fromJSON(t)}},l=n(o,c);export{l as Set};
|
package/dist/try/index.d.ts
CHANGED
|
@@ -1,2 +1,97 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dn as Extractable, mn as Doable, n as FunctypeBase, nn as Reshapeable, rn as Promisable } from "../Functype-Dc440LS5.js";
|
|
2
|
+
import { l as Type, s as Pipe } from "../Typeable-E4-aX9Gc.js";
|
|
3
|
+
import { Option } from "../option/index.js";
|
|
4
|
+
import { List } from "../list/index.js";
|
|
5
|
+
import { Either } from "../either/index.js";
|
|
6
|
+
|
|
7
|
+
//#region src/try/Try.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Possible types of Try instances
|
|
10
|
+
*/
|
|
11
|
+
type TypeNames = "Success" | "Failure";
|
|
12
|
+
interface Try<T> extends FunctypeBase<T, TypeNames>, Extractable<T>, Pipe<T>, Promisable<T>, Doable<T>, Reshapeable<T> {
|
|
13
|
+
readonly _tag: TypeNames;
|
|
14
|
+
readonly error: Error | undefined;
|
|
15
|
+
isSuccess(): this is Try<T> & {
|
|
16
|
+
readonly _tag: "Success";
|
|
17
|
+
error: undefined;
|
|
18
|
+
};
|
|
19
|
+
isFailure(): this is Try<T> & {
|
|
20
|
+
readonly _tag: "Failure";
|
|
21
|
+
error: Error;
|
|
22
|
+
};
|
|
23
|
+
orElse: (defaultValue: T) => T;
|
|
24
|
+
orThrow: (error?: Error) => T;
|
|
25
|
+
or: (alternative: Try<T>) => Try<T>;
|
|
26
|
+
orNull: () => T | null;
|
|
27
|
+
orUndefined: () => T | undefined;
|
|
28
|
+
toOption: () => Option<T>;
|
|
29
|
+
toEither: <E extends Type>(leftValue: E) => Either<E, T>;
|
|
30
|
+
toList: () => List<T>;
|
|
31
|
+
toTry: () => Try<T>;
|
|
32
|
+
map: <U>(f: (value: T) => U) => Try<U>;
|
|
33
|
+
ap: <U>(ff: Try<(value: T) => U>) => Try<U>;
|
|
34
|
+
flatMap: <U>(f: (value: T) => Try<U>) => Try<U>;
|
|
35
|
+
flatMapAsync: <U>(f: (value: T) => Promise<Try<U>>) => Promise<Try<U>>;
|
|
36
|
+
/**
|
|
37
|
+
* Pattern matches over the Try, applying onFailure if Failure and onSuccess if Success
|
|
38
|
+
* @param onFailure - Function to apply if the Try is Failure
|
|
39
|
+
* @param onSuccess - Function to apply if the Try is Success
|
|
40
|
+
* @returns The result of applying the appropriate function
|
|
41
|
+
*/
|
|
42
|
+
fold: <U extends Type>(onFailure: (error: Error) => U, onSuccess: (value: T) => U) => U;
|
|
43
|
+
toString: () => string;
|
|
44
|
+
/**
|
|
45
|
+
* Pattern matches over the Try, applying a handler function based on the variant
|
|
46
|
+
* @param patterns - Object with handler functions for Success and Failure variants
|
|
47
|
+
* @returns The result of applying the matching handler function
|
|
48
|
+
*/
|
|
49
|
+
match<R>(patterns: {
|
|
50
|
+
Success: (value: T) => R;
|
|
51
|
+
Failure: (error: Error) => R;
|
|
52
|
+
}): R;
|
|
53
|
+
toValue(): {
|
|
54
|
+
_tag: TypeNames;
|
|
55
|
+
value: T | Error;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
declare const Try: (<T>(f: () => T) => Try<T>) & {
|
|
59
|
+
/**
|
|
60
|
+
* Type guard to check if a Try is Success
|
|
61
|
+
* @param tryValue - The Try to check
|
|
62
|
+
* @returns True if Try is Success
|
|
63
|
+
*/
|
|
64
|
+
isSuccess: <T>(tryValue: Try<T>) => tryValue is Try<T> & {
|
|
65
|
+
readonly _tag: "Success";
|
|
66
|
+
error: undefined;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Type guard to check if a Try is Failure
|
|
70
|
+
* @param tryValue - The Try to check
|
|
71
|
+
* @returns True if Try is Failure
|
|
72
|
+
*/
|
|
73
|
+
isFailure: <T>(tryValue: Try<T>) => tryValue is Try<T> & {
|
|
74
|
+
readonly _tag: "Failure";
|
|
75
|
+
error: Error;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Creates a Try from JSON string
|
|
79
|
+
* @param json - The JSON string
|
|
80
|
+
* @returns Try instance
|
|
81
|
+
*/
|
|
82
|
+
fromJSON: <T>(json: string) => Try<T>;
|
|
83
|
+
/**
|
|
84
|
+
* Creates a Try from YAML string
|
|
85
|
+
* @param yaml - The YAML string
|
|
86
|
+
* @returns Try instance
|
|
87
|
+
*/
|
|
88
|
+
fromYAML: <T>(yaml: string) => Try<T>;
|
|
89
|
+
/**
|
|
90
|
+
* Creates a Try from binary string
|
|
91
|
+
* @param binary - The binary string
|
|
92
|
+
* @returns Try instance
|
|
93
|
+
*/
|
|
94
|
+
fromBinary: <T>(binary: string) => Try<T>;
|
|
95
|
+
};
|
|
96
|
+
//#endregion
|
|
2
97
|
export { Try, TypeNames };
|
package/dist/try/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{rt as e,tt as t}from"../Valuable-B8h0iKI_.js";import{t as n}from"../Companion-VlxcFhzb.js";import{None as r,Option as i,Some as a}from"../option/index.js";import{List as o}from"../list/index.js";import{Left as s,Right as c}from"../either/index.js";import l from"safe-stable-stringify";const u=t=>({_tag:`Success`,error:void 0,isSuccess(){return!0},isFailure(){return!1},orElse:e=>t,orThrow:e=>t,or:e=>u(t),orNull:()=>t,orUndefined:()=>t,toEither:e=>c(t),map:e=>m(()=>e(t)),ap:e=>e.map(e=>e(t)),flatMap:e=>e(t),flatMapAsync:async e=>e(t),fold:(e,n)=>n(t),match:e=>e.Success(t),foldLeft:e=>n=>n(e,t),foldRight:e=>n=>n(t,e),toString:()=>`Success(${l(t)})`,toPromise:()=>Promise.resolve(t),toValue:()=>({_tag:`Success`,value:t}),toOption:()=>a(t),toList:()=>o([t]),toTry:()=>u(t),pipe:e=>e(t),serialize:()=>e(`Success`,t),get size(){return 1},get isEmpty(){return!1},contains:e=>t===e,reduce:e=>t,reduceRight:e=>t,count:e=>e(t)?1:0,find:e=>e(t)?i(t):i(void 0),exists:e=>e(t),forEach:e=>e(t),doUnwrap(){return{ok:!0,value:t}}}),d=e=>({_tag:`Failure`,error:e,isSuccess(){return!1},isFailure(){return!0},orElse:e=>e,orThrow:t=>{throw t??e},or:e=>e,orNull:()=>null,orUndefined:()=>void 0,toEither:t=>s(e),map:t=>d(e),ap:t=>d(e),flatMap:t=>d(e),flatMapAsync:t=>Promise.resolve(d(e)),fold:(t,n)=>t(e),match:t=>t.Failure(e),foldLeft:e=>t=>e,foldRight:e=>t=>e,toString:()=>`Failure(${l(e)}))`,toPromise:()=>Promise.reject(e),toValue:()=>({_tag:`Failure`,value:e}),toOption:()=>r(),toList:()=>o([]),toTry:()=>d(e),pipe:t=>{throw e},serialize:()=>t({_tag:`Failure`,error:e.message,stack:e.stack}),get size(){return 0},get isEmpty(){return!0},contains:e=>!1,reduce:e=>{throw Error(`Cannot reduce a Failure`)},reduceRight:e=>{throw Error(`Cannot reduceRight a Failure`)},count:e=>0,find:e=>i(null),exists:e=>!1,forEach:e=>{},doUnwrap(){return{ok:!1,empty:!1,error:e}}}),f=e=>{try{return u(e())}catch(e){return d(e instanceof Error?e:Error(String(e)))}},p={isSuccess:e=>e.isSuccess(),isFailure:e=>e.isFailure(),fromJSON:e=>{let t=JSON.parse(e);if(t._tag===`Success`)return u(t.value);{let e=Error(t.error);return t.stack&&(e.stack=t.stack),d(e)}},fromYAML:e=>{let t=e.split(`
|
|
2
|
+
`),n=t[0]?.split(`: `)[1];if(!n)return d(Error(`Invalid YAML format for Try`));if(n===`Success`){let e=t[1]?.split(`: `)[1];return e?u(JSON.parse(e)):d(Error(`Invalid YAML format for Try Success`))}else{let e=t[1]?.split(`: `)[1];if(!e)return d(Error(`Invalid YAML format for Try Failure`));let n=t[2]?.split(`: `),r=n&&n.length>1?n.slice(1).join(`: `):void 0,i=Error(e);return r&&(i.stack=r),d(i)}},fromBinary:e=>{let t=Buffer.from(e,`base64`).toString();return p.fromJSON(t)}},m=n(f,p);export{m as Try};
|
package/dist/tuple/index.d.ts
CHANGED
|
@@ -1,2 +1,76 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as Serializable, c as Foldable, l as Type, n as Typeable, s as Pipe } from "../Typeable-E4-aX9Gc.js";
|
|
2
|
+
|
|
3
|
+
//#region src/tuple/Tuple.d.ts
|
|
4
|
+
interface Tuple<T extends Type[]> extends Foldable<T[number]>, Pipe<Tuple<T>>, Serializable<Tuple<T>>, Typeable<"Tuple"> {
|
|
5
|
+
get<K extends number>(index: K): T[K];
|
|
6
|
+
map<U extends Type[]>(f: (value: T) => U): Tuple<U>;
|
|
7
|
+
flatMap<U extends Type[]>(f: (value: T) => Tuple<U>): Tuple<U>;
|
|
8
|
+
toArray(): T;
|
|
9
|
+
length: number;
|
|
10
|
+
[Symbol.iterator](): Iterator<T[number]>;
|
|
11
|
+
toString(): string;
|
|
12
|
+
toValue(): {
|
|
13
|
+
_tag: "Tuple";
|
|
14
|
+
value: T;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Tuple provides a type-safe, fixed-length array with functional operations.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // Creating tuples
|
|
22
|
+
* const t1 = Tuple([1, "hello", true])
|
|
23
|
+
* const t2 = Tuple.of(1, "hello", true)
|
|
24
|
+
* const pair = Tuple.pair("key", 42)
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Type-safe access
|
|
28
|
+
* const triple = Tuple.triple("x", 10, true)
|
|
29
|
+
* const first = triple.get(0) // string
|
|
30
|
+
* const second = triple.get(1) // number
|
|
31
|
+
* const third = triple.get(2) // boolean
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* // Functional operations
|
|
35
|
+
* const doubled = Tuple([1, 2, 3])
|
|
36
|
+
* .map(arr => arr.map(x => x * 2))
|
|
37
|
+
* .toArray() // [2, 4, 6]
|
|
38
|
+
*/
|
|
39
|
+
declare const Tuple: (<T extends Type[]>(values: T) => Tuple<T>) & {
|
|
40
|
+
/**
|
|
41
|
+
* Create a Tuple from multiple arguments
|
|
42
|
+
* @example
|
|
43
|
+
* const t = Tuple.of(1, "hello", true)
|
|
44
|
+
* // TypeScript infers: Tuple<[number, string, boolean]>
|
|
45
|
+
*/
|
|
46
|
+
of: <T extends Type[]>(...values: T) => Tuple<T>;
|
|
47
|
+
/**
|
|
48
|
+
* Create a Tuple of size 2 (pair)
|
|
49
|
+
* @example
|
|
50
|
+
* const pair = Tuple.pair("key", 42)
|
|
51
|
+
* // TypeScript infers: Tuple<[string, number]>
|
|
52
|
+
*/
|
|
53
|
+
pair: <A extends Type, B extends Type>(first: A, second: B) => Tuple<[A, B]>;
|
|
54
|
+
/**
|
|
55
|
+
* Create a Tuple of size 3 (triple)
|
|
56
|
+
* @example
|
|
57
|
+
* const triple = Tuple.triple("x", 10, true)
|
|
58
|
+
* // TypeScript infers: Tuple<[string, number, boolean]>
|
|
59
|
+
*/
|
|
60
|
+
triple: <A extends Type, B extends Type, C extends Type>(first: A, second: B, third: C) => Tuple<[A, B, C]>;
|
|
61
|
+
/**
|
|
62
|
+
* Create an empty Tuple
|
|
63
|
+
* @example
|
|
64
|
+
* const empty = Tuple.empty()
|
|
65
|
+
* // TypeScript infers: Tuple<[]>
|
|
66
|
+
*/
|
|
67
|
+
empty: () => Tuple<[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Create a Tuple from an array (alias for constructor)
|
|
70
|
+
* @example
|
|
71
|
+
* const t = Tuple.from([1, 2, 3])
|
|
72
|
+
*/
|
|
73
|
+
from: <T extends Type[]>(values: T) => Tuple<T>;
|
|
74
|
+
};
|
|
75
|
+
//#endregion
|
|
2
76
|
export { Tuple };
|
package/dist/tuple/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"../
|
|
1
|
+
import{t as e}from"../Companion-VlxcFhzb.js";import t from"safe-stable-stringify";const n=e=>{let n={_tag:`Tuple`,map:t=>r(t(e)),flatMap:t=>t(e),get:t=>e[t],toArray:()=>e,length:e.length,[Symbol.iterator](){let t=0;return{next:()=>t<e.length?{value:e[t++],done:!1}:{value:void 0,done:!0}}},fold:(t,n)=>e.length===0?t():n(e[0]),foldLeft:t=>n=>e.reduce(n,t),foldRight:t=>n=>e.reduceRight((e,t)=>n(t,e),t),pipe:e=>e(n),serialize:()=>({toJSON:()=>JSON.stringify({_tag:`Tuple`,value:e}),toYAML:()=>`_tag: Tuple\nvalue: ${t(e)}`,toBinary:()=>Buffer.from(JSON.stringify({_tag:`Tuple`,value:e})).toString(`base64`)}),toValue:()=>({_tag:`Tuple`,value:e}),toString:()=>`Tuple(${e.map(e=>String(e)).join(`, `)})`};return n},r=e(e=>n(e),{of:(...e)=>n(e),pair:(e,t)=>n([e,t]),triple:(e,t,r)=>n([e,t,r]),empty:()=>n([]),from:e=>n(e)});export{r as Tuple};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "functype",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A functional programming library for TypeScript, using immutable data structures and type classes",
|
|
6
6
|
"author": "jordan.burke@gmail.com",
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
"cli-example": "npx . Option"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@eslint/compat": "^2.0.
|
|
48
|
-
"@types/node": "~24.10.
|
|
47
|
+
"@eslint/compat": "^2.0.2",
|
|
48
|
+
"@types/node": "~24.10.11",
|
|
49
49
|
"eslint-config-functype": "1.3.0",
|
|
50
50
|
"eslint-plugin-functional": "^9.0.2",
|
|
51
51
|
"fast-check": "^4.5.3",
|
|
52
|
-
"globals": "^17.
|
|
53
|
-
"ts-builds": "^2.2
|
|
54
|
-
"tsdown": "^0.
|
|
52
|
+
"globals": "^17.3.0",
|
|
53
|
+
"ts-builds": "^2.3.2",
|
|
54
|
+
"tsdown": "^0.20.3",
|
|
55
55
|
"tsx": "^4.21.0",
|
|
56
56
|
"typedoc": "^0.28.16"
|
|
57
57
|
},
|
|
@@ -164,5 +164,5 @@
|
|
|
164
164
|
"safe-stable-stringify": "^2.5.0"
|
|
165
165
|
},
|
|
166
166
|
"sideEffects": false,
|
|
167
|
-
"packageManager": "pnpm@10.28.
|
|
167
|
+
"packageManager": "pnpm@10.28.2+sha512.41872f037ad22f7348e3b1debbaf7e867cfd448f2726d9cf74c08f19507c31d2c8e7a11525b983febc2df640b5438dee6023ebb1f84ed43cc2d654d2bc326264"
|
|
168
168
|
}
|
package/dist/Brand-B_uQBKwR.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
//#region src/branded/Brand.d.ts
|
|
2
|
-
type Brand<K extends string, T> = T & {
|
|
3
|
-
readonly __brand: K;
|
|
4
|
-
};
|
|
5
|
-
type Unwrap<T> = T extends Brand<string, infer U> ? U : T;
|
|
6
|
-
type ExtractBrand<T> = T extends Brand<infer K, unknown> ? K : never;
|
|
7
|
-
/**
|
|
8
|
-
* Brand is a utility for creating nominal typing in TypeScript.
|
|
9
|
-
* It creates phantom types that exist only at compile time.
|
|
10
|
-
* At runtime, the branded value IS the primitive value.
|
|
11
|
-
*
|
|
12
|
-
* @param _brand
|
|
13
|
-
* @param value - The value to brand
|
|
14
|
-
* @returns The value with phantom type brand
|
|
15
|
-
*/
|
|
16
|
-
declare function Brand<K extends string, T>(_brand: K, value: T): Brand<K, T>;
|
|
17
|
-
/**
|
|
18
|
-
* Helper to unwrap a branded value to its underlying type
|
|
19
|
-
* Works with both Brand and ValidatedBrand
|
|
20
|
-
* @param branded - The branded value (can be null or undefined)
|
|
21
|
-
* @returns The original value without the brand
|
|
22
|
-
*
|
|
23
|
-
* Note: Also exported as 'unwrap' from 'functype/branded' for convenience
|
|
24
|
-
*/
|
|
25
|
-
declare function unwrapBrand<K extends string, T>(branded: Brand<K, T>): T;
|
|
26
|
-
declare function unwrapBrand<K extends string, T>(branded: Brand<K, T> | null): T | null;
|
|
27
|
-
declare function unwrapBrand<K extends string, T>(branded: Brand<K, T> | undefined): T | undefined;
|
|
28
|
-
declare function unwrapBrand<K extends string, T>(branded: Brand<K, T> | null | undefined): T | null | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* Type guard for checking if a value has a specific brand
|
|
31
|
-
* @param value - The value to check
|
|
32
|
-
* @param _brand - The brand to check for (unused at runtime)
|
|
33
|
-
* @returns True if the value has the specified brand
|
|
34
|
-
*
|
|
35
|
-
* Note: Since brands are phantom types that exist only at compile time,
|
|
36
|
-
* this function can only provide a runtime approximation. It always returns true
|
|
37
|
-
* for non-null values, as we have no way to actually check the brand at runtime.
|
|
38
|
-
* This function is primarily for API consistency and documentation purposes.
|
|
39
|
-
*/
|
|
40
|
-
declare function hasBrand<K extends string, T>(value: unknown, _brand: K): value is Brand<K, T>;
|
|
41
|
-
/**
|
|
42
|
-
* Create a branded type constructor for a specific brand
|
|
43
|
-
* @param brand - The brand name
|
|
44
|
-
* @returns A function that brands values with the specified brand
|
|
45
|
-
*/
|
|
46
|
-
declare function createBrander<K extends string, T>(brand: K): (value: T) => Brand<K, T>;
|
|
47
|
-
type BrandedString<K extends string> = Brand<K, string>;
|
|
48
|
-
type BrandedNumber<K extends string> = Brand<K, number>;
|
|
49
|
-
type BrandedBoolean<K extends string> = Brand<K, boolean>;
|
|
50
|
-
declare const BrandedString: <K extends string>(brand: K) => (value: string) => BrandedString<K>;
|
|
51
|
-
declare const BrandedNumber: <K extends string>(brand: K) => (value: number) => BrandedNumber<K>;
|
|
52
|
-
declare const BrandedBoolean: <K extends string>(brand: K) => (value: boolean) => BrandedBoolean<K>;
|
|
53
|
-
//#endregion
|
|
54
|
-
export { ExtractBrand as a, hasBrand as c, BrandedString as i, unwrapBrand as l, BrandedBoolean as n, Unwrap as o, BrandedNumber as r, createBrander as s, Brand as t };
|
package/dist/Brand-DxglW-qB.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e,t){return t}function t(e){return e??e}function n(e,t){return e!=null}function r(t){return n=>e(t,n)}const i=t=>n=>e(t,n),a=t=>n=>e(t,n),o=t=>n=>e(t,n);export{r as a,i,o as n,n as o,a as r,t as s,e as t};
|
package/dist/Tuple-BQLc_Ion.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"safe-stable-stringify";function t(e,t){return Object.assign(e,t)}function n(e,n){return t(e,n)}const r=t=>{let n={_tag:`Tuple`,map:e=>i(e(t)),flatMap:e=>e(t),get:e=>t[e],toArray:()=>t,length:t.length,[Symbol.iterator](){let e=0;return{next:()=>e<t.length?{value:t[e++],done:!1}:{value:void 0,done:!0}}},fold:(e,n)=>t.length===0?e():n(t[0]),foldLeft:e=>n=>t.reduce(n,e),foldRight:e=>n=>t.reduceRight((e,t)=>n(t,e),e),pipe:e=>e(n),serialize:()=>({toJSON:()=>JSON.stringify({_tag:`Tuple`,value:t}),toYAML:()=>`_tag: Tuple\nvalue: ${e(t)}`,toBinary:()=>Buffer.from(JSON.stringify({_tag:`Tuple`,value:t})).toString(`base64`)}),toValue:()=>({_tag:`Tuple`,value:t}),toString:()=>`Tuple(${t.map(e=>String(e)).join(`, `)})`};return n},i=n(e=>r(e),{of:(...e)=>r(e),pair:(e,t)=>r([e,t]),triple:(e,t,n)=>r([e,t,n]),empty:()=>r([]),from:e=>r(e)});export{n,t as r,i as t};
|