functype 0.48.0 → 0.50.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/README.md +1 -0
- package/dist/Brand-BJIRbUKB.d.ts +54 -0
- package/dist/{Typeable-lfO2nRVW.d.ts → Tuple-DmywDCE9.d.ts} +75 -1
- package/dist/Tuple-eVwTSeSr.js +1 -0
- package/dist/branded/index.d.ts +1 -53
- package/dist/cli/exports.js +1 -1
- package/dist/cli/index.js +4 -4
- package/dist/do/index.d.ts +2 -184
- package/dist/do/index.js +1 -1
- package/dist/either/index.d.ts +1 -187
- package/dist/either/index.js +1 -2
- package/dist/{full-interfaces-DXVOawTK.js → full-interfaces-DVRjnPWW.js} +13 -1
- package/dist/{Functype-rgysbeU6.d.ts → index-OdnROQtM.d.ts} +915 -8
- package/dist/index.d.ts +4 -12
- package/dist/index.js +1 -1
- package/dist/list/index.d.ts +1 -84
- package/dist/list/index.js +1 -2
- package/dist/map/index.d.ts +1 -72
- package/dist/map/index.js +1 -2
- package/dist/option/index.d.ts +1 -242
- package/dist/option/index.js +1 -2
- package/dist/set/index.d.ts +1 -53
- package/dist/set/index.js +1 -2
- package/dist/src-ByDeJzWj.js +19 -0
- package/dist/try/index.d.ts +1 -96
- package/dist/try/index.js +1 -2
- package/dist/tuple/index.d.ts +1 -76
- package/dist/tuple/index.js +1 -1
- package/package.json +11 -12
- package/dist/Companion-VlxcFhzb.js +0 -1
- package/dist/Valuable-CXh58HBk.js +0 -13
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ as
|
|
3
|
-
import { a as
|
|
4
|
-
|
|
5
|
-
import { Tuple } from "./tuple/index.js";
|
|
6
|
-
import { Map, SafeTraversable } from "./map/index.js";
|
|
7
|
-
import { Set } from "./set/index.js";
|
|
8
|
-
import { None, Option, OptionConstructor, Some } from "./option/index.js";
|
|
9
|
-
import { List } from "./list/index.js";
|
|
10
|
-
import { Either, Left, Right, TestEither, TypeCheckLeft, TypeCheckRight, isLeft, isRight, tryCatch, tryCatchAsync } from "./either/index.js";
|
|
11
|
-
import { $, Do, DoAsync, DoGenerator, EmptyListError, FailureError, FailureErrorType, LeftError, LeftErrorType, NoneError, isDoCapable, unwrap } from "./do/index.js";
|
|
12
|
-
export { $, Applicative, Async, AsyncMonad, Base, BoundedNumber, BoundedString, Brand, BrandedBoolean, type BrandedBoolean as BrandedBooleanType, BrandedNumber, type BrandedNumber as BrandedNumberType, BrandedString, type BrandedString as BrandedStringType, CancellationToken, CancellationTokenSource, Collection, CollectionOps, Companion, CompanionMethods, Cond, ContainerOps, Context, Context as ContextType, ContextServices, Do, DoAsync, DoGenerator, DoResult, Doable, ESMap, ESMapType, Either, EitherKind, EmailAddress, EmptyListError, Err, ErrorChainElement, ErrorCode, ErrorFormatterOptions, ErrorMessage, ErrorStatus, ErrorWithTaskInfo, Exit, Exit as ExitType, ExitTag, type ExtractBrand, ExtractTag, Extractable, FailureError, FailureErrorType, FieldValidation, Foldable, FoldableUtils, FormValidation, Functor, Functype, FunctypeBase, FunctypeCollection, HKT, HasService, IO, IO as IOType, Task as IOTask, ISO8601Date, Identity, InstanceType, IntegerNumber, InterruptedError, Kind, Layer, Layer as LayerType, LayerError, LayerInput, LayerOutput, Lazy, Lazy as LazyType, LazyList, Left, LeftError, LeftErrorType, List, ListKind, Map, Match, Matchable, MatchableUtils, Monad, NAME, NonEmptyString, NonNegativeNumber, None, NoneError, Ok, Option, OptionConstructor, OptionKind, ParseError, PatternString, Pipe, PositiveInteger, PositiveNumber, Promisable, RIO, Ref, Ref as RefType, Right, SafeTraversable, Serializable, SerializationMethods, SerializationResult, Set, Some, Stack, Sync, Tag, Tag as TagType, TagService, TaggedThrowable, Task$1 as Task, TaskErrorInfo, TaskFailure, TaskMetadata, TaskOutcome, TaskParams, TaskResult, TaskSuccess, TestClock, TestClock as TestClockType, TestClockTag, TestContext, TestContext as TestContextType, TestEither, Throwable, ThrowableType, TimeoutError, Traversable, Try, TryKind, Tuple, Type, TypeCheckLeft, TypeCheckRight, TypeNames, Typeable, TypeableParams, TypedError, TypedErrorContext, UIO, UUID, UniversalContainer, UntypedMatch, type Unwrap, UrlString, ValidatedBrand, type ValidatedBrand as ValidatedBrandType, type ValidatedBrandCompanion, Validation, ValidationRule, Validator, Valuable, ValuableParams, createBrander, createCancellationTokenSource, createCustomSerializer, createErrorSerializer, createSerializationCompanion, createSerializer, formatError, formatStackTrace, fromBinary, fromJSON, fromYAML, hasBrand, isCompanion, isDoCapable, isExtractable, isLeft, isRight, isTaggedThrowable, isTypeable, safeStringify, tryCatch, tryCatchAsync, unwrap, unwrapBrand };
|
|
1
|
+
import { a as ExtractBrand, c as hasBrand, i as BrandedString, l as unwrapBrand, n as BrandedBoolean, o as Unwrap, r as BrandedNumber, s as createBrander, t as Brand } from "./Brand-BJIRbUKB.js";
|
|
2
|
+
import { $ as TestClockTag, $t as TaskFailure, A as OptionConstructor, An as ValidatedBrand, At as ValidationRule, B as fromBinary, Bn as ContainerOps, Bt as TaskErrorInfo, C as Functype, Cn as NonEmptyString, Ct as OptionKind, D as List, Dn as PositiveNumber, Dt as FieldValidation, E as Collection, En as PositiveInteger, Et as FoldableUtils, F as Set, Fn as Applicative, Ft as TypedError, G as MatchableUtils, Gn as Doable, Gt as Async, H as fromYAML, Hn as Extractable, Ht as formatError, I as SerializationResult, In as AsyncMonad, It as TypedErrorContext, J as Map, Jt as Err, K as ESMap, Kn as ParseError, Kt as CancellationToken, L as createCustomSerializer, Ln as Functor, Lt as ErrorChainElement, M as Stack, Mn as Try, Mt as ErrorCode, N as Valuable, Nn as TypeNames, Nt as ErrorMessage, O as None, On as UUID, Ot as FormValidation, P as ValuableParams, Pn as Promisable, Pt as ErrorStatus, Q as TestClock, Qt as Task$1, R as createSerializationCompanion, Rn as Monad, Rt as ErrorFormatterOptions, S as tryCatchAsync, Sn as IntegerNumber, St as ListKind, T as FunctypeCollection, Tn as PatternString, Tt as UniversalContainer, U as Ref, Un as isExtractable, Ut as formatStackTrace, V as fromJSON, Vn as LazyList, Vt as createErrorSerializer, W as Matchable, Wn as DoResult, Wt as safeStringify, X as Traversable, Xt as Sync, Y as SafeTraversable, Yt as Ok, Z as Lazy, Zt as TaggedThrowable, _ as TypeCheckLeft, _n as Companion, _t as TagService, a as EmptyListError, an as createCancellationTokenSource, at as TimeoutError, b as isRight, bn as EmailAddress, bt as HKT, c as LeftError, cn as Throwable, ct as LayerError, d as isDoCapable, dn as Match, dt as Exit, en as TaskMetadata, et as TestContext, f as unwrap, fn as UntypedMatch, ft as ExitTag, g as TestEither, gn as isCompanion, gt as Tag, h as Right, hn as InstanceType, ht as HasService, i as DoGenerator, in as TaskSuccess, it as Task, j as Some, jn as ValidatedBrandCompanion, jt as Validator, k as Option, kn as UrlString, kt as Validation, l as LeftErrorType, ln as ThrowableType, lt as LayerInput, m as Left, mn as CompanionMethods, mt as ContextServices, n as Do, nn as TaskParams, nt as InterruptedError, o as FailureError, on as isTaggedThrowable, ot as UIO, p as Either, pn as Cond, pt as Context, q as ESMapType, qt as CancellationTokenSource, r as DoAsync, rn as TaskResult, rt as RIO, s as FailureErrorType, sn as NAME, st as Layer, t as $, tn as TaskOutcome, tt as IO, u as NoneError, un as Base, ut as LayerOutput, v as TypeCheckRight, vn as BoundedNumber, vt as Identity, w as FunctypeBase, wn as NonNegativeNumber, wt as TryKind, x as tryCatch, xn as ISO8601Date, xt as Kind, y as isLeft, yn as BoundedString, yt as EitherKind, z as createSerializer, zn as CollectionOps, zt as ErrorWithTaskInfo } from "./index-OdnROQtM.js";
|
|
3
|
+
import { a as isTypeable, c as Pipe, i as TypeableParams, l as Foldable, n as ExtractTag, o as Serializable, r as Typeable, s as SerializationMethods, t as Tuple, u as Type } from "./Tuple-DmywDCE9.js";
|
|
4
|
+
export { $, Applicative, Async, AsyncMonad, Base, BoundedNumber, BoundedString, Brand, BrandedBoolean, BrandedBoolean as BrandedBooleanType, BrandedNumber, BrandedNumber as BrandedNumberType, BrandedString, BrandedString as BrandedStringType, CancellationToken, CancellationTokenSource, Collection, CollectionOps, Companion, CompanionMethods, Cond, ContainerOps, Context, Context as ContextType, ContextServices, Do, DoAsync, DoGenerator, DoResult, Doable, ESMap, ESMapType, Either, EitherKind, EmailAddress, EmptyListError, Err, ErrorChainElement, ErrorCode, ErrorFormatterOptions, ErrorMessage, ErrorStatus, ErrorWithTaskInfo, Exit, Exit as ExitType, ExitTag, ExtractBrand, ExtractTag, Extractable, FailureError, FailureErrorType, FieldValidation, Foldable, FoldableUtils, FormValidation, Functor, Functype, FunctypeBase, FunctypeCollection, HKT, HasService, IO, IO as IOType, Task as IOTask, ISO8601Date, Identity, InstanceType, IntegerNumber, InterruptedError, Kind, Layer, Layer as LayerType, LayerError, LayerInput, LayerOutput, Lazy, Lazy as LazyType, LazyList, Left, LeftError, LeftErrorType, List, ListKind, Map, Match, Matchable, MatchableUtils, Monad, NAME, NonEmptyString, NonNegativeNumber, None, NoneError, Ok, Option, OptionConstructor, OptionKind, ParseError, PatternString, Pipe, PositiveInteger, PositiveNumber, Promisable, RIO, Ref, Ref as RefType, Right, SafeTraversable, Serializable, SerializationMethods, SerializationResult, Set, Some, Stack, Sync, Tag, Tag as TagType, TagService, TaggedThrowable, Task$1 as Task, TaskErrorInfo, TaskFailure, TaskMetadata, TaskOutcome, TaskParams, TaskResult, TaskSuccess, TestClock, TestClock as TestClockType, TestClockTag, TestContext, TestContext as TestContextType, TestEither, Throwable, ThrowableType, TimeoutError, Traversable, Try, TryKind, Tuple, Type, TypeCheckLeft, TypeCheckRight, TypeNames, Typeable, TypeableParams, TypedError, TypedErrorContext, UIO, UUID, UniversalContainer, UntypedMatch, Unwrap, UrlString, ValidatedBrand, ValidatedBrand as ValidatedBrandType, ValidatedBrandCompanion, Validation, ValidationRule, Validator, Valuable, ValuableParams, createBrander, createCancellationTokenSource, createCustomSerializer, createErrorSerializer, createSerializationCompanion, createSerializer, formatError, formatStackTrace, fromBinary, fromJSON, fromYAML, hasBrand, isCompanion, isDoCapable, isExtractable, isLeft, isRight, isTaggedThrowable, isTypeable, safeStringify, tryCatch, tryCatchAsync, unwrap, unwrapBrand };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Brand as e,BrandedBoolean as t,BrandedNumber as n,BrandedString as r,createBrander as i,hasBrand as a,unwrap as o}from"./branded/index.js";import{$ as s,A as c,
|
|
1
|
+
import{Brand as e,BrandedBoolean as t,BrandedNumber as n,BrandedString as r,createBrander as i,hasBrand as a,unwrap as o}from"./branded/index.js";import{$ as s,A as c,At as l,B as u,C as d,Ct as f,D as p,Dt as m,E as h,Et as g,F as _,G as v,H as y,I as b,J as x,K as S,L as C,M as w,Mt as T,N as E,O as D,Ot as O,P as k,Q as A,R as j,S as M,St as N,T as P,Tt as F,U as I,V as L,W as R,X as z,Y as B,Z as V,_ as H,_t as U,a as W,at as G,b as K,bt as q,c as J,ct as Y,d as X,dt as Z,et as Q,f as $,ft as ee,g as te,gt as ne,h as re,ht as ie,i as ae,it as oe,j as se,jt as ce,k as le,kt as ue,l as de,lt as fe,m as pe,mt as me,n as he,nt as ge,o as _e,ot as ve,p as ye,pt as be,q as xe,r as Se,rt as Ce,s as we,st as Te,t as Ee,tt as De,u as Oe,ut as ke,v as Ae,vt as je,w as Me,wt as Ne,x as Pe,xt as Fe,y as Ie,yt as Le,z as Re}from"./src-ByDeJzWj.js";import{r as ze,t as Be}from"./Tuple-eVwTSeSr.js";export{p as $,I as Base,xe as BoundedNumber,x as BoundedString,e as Brand,t as BrandedBoolean,n as BrandedNumber,r as BrandedString,ze as Companion,v as Cond,te as Context,D as Do,le as DoAsync,W as ESMap,ve as Either,B as EmailAddress,c as EmptyListError,b as Err,re as Exit,se as FailureError,Ie as FoldableUtils,Ae as HKT,$ as IO,z as ISO8601Date,H as Identity,V as IntegerNumber,ye as InterruptedError,X as Layer,_e as Lazy,Le as LazyList,Te as Left,w as LeftError,ie as List,ae as Map,R as Match,Se as MatchableUtils,L as NAME,A as NonEmptyString,s as NonNegativeNumber,N as None,E as NoneError,C as Ok,f as Option,Ne as OptionConstructor,T as ParseError,Q as PatternString,De as PositiveInteger,ge as PositiveNumber,q as Ref,Y as Right,Fe as Set,F as Some,he as Stack,Oe as Tag,j as Task,we as TestClock,J as TestClockTag,de as TestContext,y as Throwable,pe as TimeoutError,je as Try,Be as Tuple,fe as TypeCheckLeft,ke as TypeCheckRight,ne as Typeable,M as TypedError,Ce as UUID,oe as UrlString,G as ValidatedBrand,Pe as Validation,Ee as Valuable,i as createBrander,Re as createCancellationTokenSource,g as createCustomSerializer,d as createErrorSerializer,m as createSerializationCompanion,O as createSerializer,Me as formatError,P as formatStackTrace,ue as fromBinary,l as fromJSON,ce as fromYAML,a as hasBrand,S as isCompanion,k as isDoCapable,K as isExtractable,Z as isLeft,ee as isRight,u as isTaggedThrowable,U as isTypeable,h as safeStringify,be as tryCatch,me as tryCatchAsync,_ as unwrap,o as unwrapBrand};
|
package/dist/list/index.d.ts
CHANGED
|
@@ -1,85 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { l as Type, n as Typeable } from "../Typeable-lfO2nRVW.js";
|
|
3
|
-
import { Option } from "../option/index.js";
|
|
4
|
-
|
|
5
|
-
//#region src/list/List.d.ts
|
|
6
|
-
interface List<A> extends FunctypeCollection<A, "List">, Doable<A>, Reshapeable<A> {
|
|
7
|
-
readonly length: number;
|
|
8
|
-
readonly [Symbol.iterator]: () => Iterator<A>;
|
|
9
|
-
map: <B>(f: (a: A) => B) => List<B>;
|
|
10
|
-
ap: <B>(ff: List<(value: A) => B>) => List<B>;
|
|
11
|
-
flatMap: <B>(f: (a: A) => Iterable<B>) => List<B>;
|
|
12
|
-
flatMapAsync: <B>(f: (a: A) => PromiseLike<Iterable<B>>) => PromiseLike<List<B>>;
|
|
13
|
-
filter<S extends A>(predicate: (a: A) => a is S): List<S>;
|
|
14
|
-
filter(predicate: (a: A) => unknown): List<A>;
|
|
15
|
-
filterNot: (p: (a: A) => boolean) => List<A>;
|
|
16
|
-
/** @internal */
|
|
17
|
-
filterType: <T extends Typeable<string, unknown>>(tag: string) => List<T & A>;
|
|
18
|
-
remove: (value: A) => List<A>;
|
|
19
|
-
removeAt: (index: number) => List<A>;
|
|
20
|
-
add: (item: A) => List<A>;
|
|
21
|
-
get: (index: number) => Option<A>;
|
|
22
|
-
concat: (other: List<A>) => List<A>;
|
|
23
|
-
take: (n: number) => List<A>;
|
|
24
|
-
takeWhile: (p: (a: A) => boolean) => List<A>;
|
|
25
|
-
takeRight: (n: number) => List<A>;
|
|
26
|
-
get last(): A | undefined;
|
|
27
|
-
get lastOption(): Option<A>;
|
|
28
|
-
get tail(): List<A>;
|
|
29
|
-
get init(): List<A>;
|
|
30
|
-
reverse: () => List<A>;
|
|
31
|
-
indexOf: (value: A) => number;
|
|
32
|
-
prepend: (item: A) => List<A>;
|
|
33
|
-
distinct: () => List<A>;
|
|
34
|
-
sorted: (compareFn?: (a: A, b: A) => number) => List<A>;
|
|
35
|
-
sortBy: <B>(f: (a: A) => B, compareFn?: (a: B, b: B) => number) => List<A>;
|
|
36
|
-
zip: <B>(other: List<B>) => List<[A, B]>;
|
|
37
|
-
zipWithIndex: () => List<[A, number]>;
|
|
38
|
-
groupBy: <K>(f: (a: A) => K) => globalThis.Map<K, List<A>>;
|
|
39
|
-
partition: (p: (a: A) => boolean) => [List<A>, List<A>];
|
|
40
|
-
span: (p: (a: A) => boolean) => [List<A>, List<A>];
|
|
41
|
-
slice: (start: number, end: number) => List<A>;
|
|
42
|
-
/**
|
|
43
|
-
* Pattern matches over the List, applying a handler function based on whether it's empty
|
|
44
|
-
* @param patterns - Object with handler functions for Empty and NonEmpty variants
|
|
45
|
-
* @returns The result of applying the matching handler function
|
|
46
|
-
*/
|
|
47
|
-
match<R>(patterns: {
|
|
48
|
-
Empty: () => R;
|
|
49
|
-
NonEmpty: (values: A[]) => R;
|
|
50
|
-
}): R;
|
|
51
|
-
}
|
|
52
|
-
declare const List: (<A>(values?: Iterable<A>) => List<A>) & {
|
|
53
|
-
/**
|
|
54
|
-
* Creates an empty List
|
|
55
|
-
* Returns a singleton instance for efficiency
|
|
56
|
-
* @returns An empty List instance
|
|
57
|
-
*/
|
|
58
|
-
empty: <A extends Type>() => List<A>;
|
|
59
|
-
/**
|
|
60
|
-
* Creates a List from variadic arguments
|
|
61
|
-
* @param values - Values to create list from
|
|
62
|
-
* @returns A List containing the values
|
|
63
|
-
*/
|
|
64
|
-
of: <A extends Type>(...values: A[]) => List<A>;
|
|
65
|
-
/**
|
|
66
|
-
* Creates a List from JSON string
|
|
67
|
-
* @param json - The JSON string
|
|
68
|
-
* @returns List instance
|
|
69
|
-
*/
|
|
70
|
-
fromJSON: <A>(json: string) => List<A>;
|
|
71
|
-
/**
|
|
72
|
-
* Creates a List from YAML string
|
|
73
|
-
* @param yaml - The YAML string
|
|
74
|
-
* @returns List instance
|
|
75
|
-
*/
|
|
76
|
-
fromYAML: <A>(yaml: string) => List<A>;
|
|
77
|
-
/**
|
|
78
|
-
* Creates a List from binary string
|
|
79
|
-
* @param binary - The binary string
|
|
80
|
-
* @returns List instance
|
|
81
|
-
*/
|
|
82
|
-
fromBinary: <A>(binary: string) => List<A>;
|
|
83
|
-
};
|
|
84
|
-
//#endregion
|
|
1
|
+
import { D as List } from "../index-OdnROQtM.js";
|
|
85
2
|
export { List };
|
package/dist/list/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`)[1]?.split(`: `)[1];return m(t?JSON.parse(t):[])},fromBinary:e=>{let t=Buffer.from(e,`base64`).toString();return p.fromJSON(t)}},m=n(d,p);export{m as List};
|
|
1
|
+
import{ht as e}from"../src-ByDeJzWj.js";export{e as List};
|
package/dist/map/index.d.ts
CHANGED
|
@@ -1,73 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as Serializable, c as Foldable, l as Type, n as Typeable, s as Pipe } from "../Typeable-lfO2nRVW.js";
|
|
3
|
-
import { Tuple } from "../tuple/index.js";
|
|
4
|
-
import { Option } from "../option/index.js";
|
|
5
|
-
|
|
6
|
-
//#region src/map/Map.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* A traversable interface for map that excludes map and flatMap operations
|
|
9
|
-
*/
|
|
10
|
-
type SafeTraversable<K, V> = Omit<Traversable<Tuple<[K, V]>>, "map" | "flatMap" | "flatMapAsync" | "ap">;
|
|
11
|
-
interface Map<K, V> extends SafeTraversable<K, V>, Collection<Tuple<[K, V]>>, Typeable<"Map">, Serializable<[K, V][]>, Pipe<[K, V][]>, Foldable<Tuple<[K, V]>>, Iterable<[K, V]> {
|
|
12
|
-
readonly [Symbol.toStringTag]: string;
|
|
13
|
-
readonly _tag: "Map";
|
|
14
|
-
add(item: Tuple<[K, V]>): Map<K, V>;
|
|
15
|
-
remove(value: K): Map<K, V>;
|
|
16
|
-
map<U>(f: (value: V) => U): Map<K, U>;
|
|
17
|
-
ap<U>(ff: Map<K, (value: V) => U>): Map<K, U>;
|
|
18
|
-
flatMap<K2, V2>(f: (entry: Tuple<[K, V]>) => Iterable<[K2, V2]>): Map<K2, V2>;
|
|
19
|
-
flatMapAsync<U>(f: (value: V) => PromiseLike<Map<K, U>>): PromiseLike<Map<K, U>>;
|
|
20
|
-
get(key: K): Option<V>;
|
|
21
|
-
getOrElse(key: K, defaultValue: V): V;
|
|
22
|
-
orElse(key: K, alternative: Option<V>): Option<V>;
|
|
23
|
-
fold<U extends Type>(onEmpty: () => U, onValue: (value: Tuple<[K, V]>) => U): U;
|
|
24
|
-
foldLeft<B>(z: B): (op: (b: B, a: Tuple<[K, V]>) => B) => B;
|
|
25
|
-
foldRight<B>(z: B): (op: (a: Tuple<[K, V]>, b: B) => B) => B;
|
|
26
|
-
/**
|
|
27
|
-
* Pattern matches over the Map, applying a handler function based on whether it's empty
|
|
28
|
-
* @param patterns - Object with handler functions for Empty and NonEmpty variants
|
|
29
|
-
* @returns The result of applying the matching handler function
|
|
30
|
-
*/
|
|
31
|
-
match<R>(patterns: {
|
|
32
|
-
Empty: () => R;
|
|
33
|
-
NonEmpty: (entries: Array<Tuple<[K, V]>>) => R;
|
|
34
|
-
}): R;
|
|
35
|
-
toValue(): {
|
|
36
|
-
_tag: "Map";
|
|
37
|
-
value: [K, V][];
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
declare const Map: (<K, V>(entries?: readonly (readonly [K, V])[] | IterableIterator<[K, V]> | null) => Map<K, V>) & {
|
|
41
|
-
/**
|
|
42
|
-
* Creates an empty Map
|
|
43
|
-
* Returns a singleton instance for efficiency
|
|
44
|
-
* @returns An empty Map instance
|
|
45
|
-
*/
|
|
46
|
-
empty: <K, V>() => Map<K, V>;
|
|
47
|
-
/**
|
|
48
|
-
* Creates a Map from variadic key-value pair arguments
|
|
49
|
-
* @param entries - Key-value pairs to create map from
|
|
50
|
-
* @returns A Map containing the entries
|
|
51
|
-
*/
|
|
52
|
-
of: <K, V>(...entries: [K, V][]) => Map<K, V>;
|
|
53
|
-
/**
|
|
54
|
-
* Creates a Map from JSON string
|
|
55
|
-
* @param json - The JSON string
|
|
56
|
-
* @returns Map instance
|
|
57
|
-
*/
|
|
58
|
-
fromJSON: <K, V>(json: string) => Map<K, V>;
|
|
59
|
-
/**
|
|
60
|
-
* Creates a Map from YAML string
|
|
61
|
-
* @param yaml - The YAML string
|
|
62
|
-
* @returns Map instance
|
|
63
|
-
*/
|
|
64
|
-
fromYAML: <K, V>(yaml: string) => Map<K, V>;
|
|
65
|
-
/**
|
|
66
|
-
* Creates a Map from binary string
|
|
67
|
-
* @param binary - The binary string
|
|
68
|
-
* @returns Map instance
|
|
69
|
-
*/
|
|
70
|
-
fromBinary: <K, V>(binary: string) => Map<K, V>;
|
|
71
|
-
};
|
|
72
|
-
//#endregion
|
|
1
|
+
import { J as Map, Y as SafeTraversable } from "../index-OdnROQtM.js";
|
|
73
2
|
export { Map, SafeTraversable };
|
package/dist/map/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{i as e
|
|
2
|
-
`)[1]?.split(`: `)[1];return d(t?JSON.parse(t):[])},fromBinary:e=>{let t=Buffer.from(e,`base64`).toString();return u.fromJSON(t)}},d=n(c,u);export{d as Map};
|
|
1
|
+
import{i as e}from"../src-ByDeJzWj.js";export{e as Map};
|
package/dist/option/index.d.ts
CHANGED
|
@@ -1,243 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { l as Type } from "../Typeable-lfO2nRVW.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
|
|
1
|
+
import { A as OptionConstructor, O as None, j as Some, k as Option } from "../index-OdnROQtM.js";
|
|
243
2
|
export { None, Option, OptionConstructor, Some };
|
package/dist/option/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{
|
|
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};
|
|
1
|
+
import{Ct as e,St as t,Tt as n,wt as r}from"../src-ByDeJzWj.js";export{t as None,e as Option,r as OptionConstructor,n as Some};
|
package/dist/set/index.d.ts
CHANGED
|
@@ -1,54 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { l as Type } from "../Typeable-lfO2nRVW.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
|
|
1
|
+
import { F as Set } from "../index-OdnROQtM.js";
|
|
54
2
|
export { Set };
|
package/dist/set/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`)[1]?.split(`: `)[1];return l(t?JSON.parse(t):[])},fromBinary:e=>{let t=Buffer.from(e,`base64`).toString();return c.fromJSON(t)}},l=t(o,c);export{l as Set};
|
|
1
|
+
import{xt as e}from"../src-ByDeJzWj.js";export{e as Set};
|