functype 0.14.0 → 0.14.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/{Either-D4P39LPj.d.ts → Either-BSiHxaKK.d.ts} +6 -2
- package/dist/{chunk-7VZBQDNM.mjs → chunk-RQFW23A2.mjs} +2 -2
- package/dist/{chunk-7VZBQDNM.mjs.map → chunk-RQFW23A2.mjs.map} +1 -1
- package/dist/do/index.d.ts +2 -2
- package/dist/do/index.mjs +1 -1
- package/dist/either/index.d.ts +1 -1
- package/dist/either/index.mjs +1 -1
- package/dist/fpromise/index.d.ts +1 -1
- package/dist/fpromise/index.mjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/list/index.d.ts +1 -1
- package/dist/list/index.mjs +1 -1
- package/dist/map/index.d.ts +1 -1
- package/dist/map/index.mjs +1 -1
- package/dist/option/index.d.ts +1 -1
- package/dist/option/index.mjs +1 -1
- package/dist/set/index.d.ts +1 -1
- package/dist/set/index.mjs +1 -1
- package/dist/try/index.d.ts +1 -1
- package/dist/try/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -9,6 +9,10 @@ import { T as Type, P as Pipe, a as Typeable, S as Serializable, F as Foldable }
|
|
|
9
9
|
* All monads that support Do-notation should implement this protocol
|
|
10
10
|
*/
|
|
11
11
|
declare const DO_PROTOCOL: unique symbol;
|
|
12
|
+
/**
|
|
13
|
+
* Type for the DO_PROTOCOL symbol
|
|
14
|
+
*/
|
|
15
|
+
type DO_PROTOCOL_TYPE = typeof DO_PROTOCOL;
|
|
12
16
|
/**
|
|
13
17
|
* Result type for Do-notation unwrapping
|
|
14
18
|
* Indicates whether unwrapping succeeded and provides the value or error
|
|
@@ -29,7 +33,7 @@ type DoResult<T> = {
|
|
|
29
33
|
* Implementing this interface allows a type to be yielded in Do-comprehensions
|
|
30
34
|
*/
|
|
31
35
|
interface DoProtocol<T> {
|
|
32
|
-
[DO_PROTOCOL]()
|
|
36
|
+
[DO_PROTOCOL]: () => DoResult<T>;
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
/**
|
|
@@ -903,4 +907,4 @@ declare const Either: {
|
|
|
903
907
|
fromBinary: <L extends Type, R extends Type>(binary: string) => Either<L, R>;
|
|
904
908
|
};
|
|
905
909
|
|
|
906
|
-
export { type Applicative as A, type Collection as C, DO_PROTOCOL as D, Either as E, type FunctypeBase as F, List as L, type Matchable as M, None as N, Option as O, type Promisable as P, Right as R, Some as S, Try as T, type DoResult as a, type Extractable as b, type Traversable as c, type
|
|
910
|
+
export { type Applicative as A, type Collection as C, DO_PROTOCOL as D, Either as E, type FunctypeBase as F, List as L, type Matchable as M, None as N, Option as O, type Promisable as P, Right as R, Some as S, Try as T, type DoResult as a, type Extractable as b, type Traversable as c, type DO_PROTOCOL_TYPE as d, type DoProtocol as e, type TestEither as f, Left as g, isLeft as h, isRight as i, TypeCheckRight as j, TypeCheckLeft as k, tryCatchAsync as l, isExtractable as m, type Functype as n, type FunctypeCollection as o, MatchableUtils as p, OptionConstructor as q, Set as r, type TypeNames as s, tryCatch as t, type CollectionOps as u, type ContainerOps as v, type AsyncMonad as w, type Functor as x, type Monad as y, type Reshapeable as z };
|
|
@@ -39,5 +39,5 @@ value: ${JSON.stringify(r)}`,toBinary:()=>Buffer.from(JSON.stringify({_tag:"Stac
|
|
|
39
39
|
`)[1]?.split(": ")[1];if(!r)return Pe([]);let n=JSON.parse(r);return Pe(n)},fromBinary:t=>{let e=Buffer.from(t,"base64").toString();return Qe.fromJSON(e)}},Pe=a(bt,Qe);function Eo(t){let e=Le({_tag:t._tag,impl:t.impl});return {...e,toValue:()=>({_tag:e._tag,value:t.value})}}var U=t=>({_tag:"Some",value:t,isEmpty:false,isSome(){return true},isNone(){return false},get:()=>t,getOrElse:()=>t,getOrThrow:()=>t,orElse:e=>U(t),orNull:()=>t,orUndefined:()=>t,map:e=>U(e(t)),ap:e=>e._tag==="Some"&&e.value?U(e.value(t)):G,filter(e){return e(t)?U(t):G},count:e=>e(t)?1:0,find:e=>e(t)?U(t):G,exists:e=>e(t),forEach:e=>e(t),fold:(e,r)=>r(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=>r=>r(e,t),foldRight:e=>r=>r(t,e),toList:()=>m([t]),contains:e=>e===t,size:1,toOption:()=>U(t),toEither:e=>c(t),toTry:()=>P(()=>t),toPromise:()=>Promise.resolve(t),toString:()=>`Some(${me(t)})`,toValue:()=>({_tag:"Some",value:t}),pipe:e=>e(t),serialize:()=>({toJSON:()=>JSON.stringify({_tag:"Some",value:t}),toYAML:()=>`_tag: Some
|
|
40
40
|
value: ${me(t)}`,toBinary:()=>Buffer.from(JSON.stringify({_tag:"Some",value:t})).toString("base64")}),[k](){return {ok:true,value:t}}}),G={_tag:"None",value:void 0,isEmpty:true,isSome(){return false},isNone(){return true},get:()=>{throw new Error("Cannot call get() on None")},getOrElse:t=>t,getOrThrow(t){throw t},orElse:t=>t,orNull:()=>null,orUndefined:()=>{},map:t=>G,ap:t=>G,filter(t){return G},count:t=>0,find:t=>G,exists:t=>false,forEach:t=>{},flatMap:t=>G,flatMapAsync:t=>Promise.resolve(G),reduce:()=>{},reduceRight:()=>{},fold:(t,e)=>t(),match:t=>t.None(),foldLeft:t=>()=>t,foldRight:t=>()=>t,toList:()=>m([]),contains:()=>false,size:0,toOption:()=>G,toEither:t=>p(t),toTry:()=>P(()=>{throw new Error("None")}),toPromise:()=>Promise.reject(new Error("Cannot convert None to Promise")),toString:()=>"None",toValue:()=>({_tag:"None",value:void 0}),pipe:t=>t(void 0),serialize:()=>({toJSON:()=>JSON.stringify({_tag:"None",value:null}),toYAML:()=>`_tag: None
|
|
41
41
|
value: null`,toBinary:()=>Buffer.from(JSON.stringify({_tag:"None",value:null})).toString("base64")}),[k](){return {ok:false,empty:true}}},w=()=>G,wt=t=>t!=null?U(t):w(),Ze={from:t=>f(t),none:()=>w(),fromJSON:t=>{let e=JSON.parse(t);return e._tag==="Some"?U(e.value):w()},fromYAML:t=>{let e=t.split(`
|
|
42
|
-
`),r=e[0]?.split(": ")[1],n=e[1]?.split(": ")[1];if(!r||!n)return w();let o=n==="null"?null:JSON.parse(n);return r==="Some"?U(o):w()},fromBinary:t=>{let e=Buffer.from(t,"base64").toString();return Ze.fromJSON(e)}},f=a(wt,Ze);export{Oe as $,xr as A,br as B,wr as C,Ur as D,Sr as E,vr as F,Or as G,Br as H,Nr as I,Vr as J,$e as K,Yr as L,qr as M,Qr as N,Hr as O,Zr as P,Xr as Q,en as R,tn as S,rn as T,ke as U,Q as V,mt as W,Se as X,yt as Y,ye as Z,H as _,k as a,N as aa,U as b,ve as ba,w as c,J as ca,wt as d,Ge as da,f as e,xe as ea,ne as f,An as fa,x as g,Ln as ga,$t as h,xn as ha,P as i,S as ia,Le as j,Bn as ja,we as k,At as ka,m as l,In as la,c as m,W as ma,p as n,Jn as na,fr as o,D as oa,dr as p,ge as pa,mr as q,Be as qa,ut as r,xt as ra,lt as s,Pe as sa,yr as t,Eo as ta,Ie as u,I as v,pt as w,Ar as x,Lr as y,kr as z};//# sourceMappingURL=chunk-
|
|
43
|
-
//# sourceMappingURL=chunk-
|
|
42
|
+
`),r=e[0]?.split(": ")[1],n=e[1]?.split(": ")[1];if(!r||!n)return w();let o=n==="null"?null:JSON.parse(n);return r==="Some"?U(o):w()},fromBinary:t=>{let e=Buffer.from(t,"base64").toString();return Ze.fromJSON(e)}},f=a(wt,Ze);export{Oe as $,xr as A,br as B,wr as C,Ur as D,Sr as E,vr as F,Or as G,Br as H,Nr as I,Vr as J,$e as K,Yr as L,qr as M,Qr as N,Hr as O,Zr as P,Xr as Q,en as R,tn as S,rn as T,ke as U,Q as V,mt as W,Se as X,yt as Y,ye as Z,H as _,k as a,N as aa,U as b,ve as ba,w as c,J as ca,wt as d,Ge as da,f as e,xe as ea,ne as f,An as fa,x as g,Ln as ga,$t as h,xn as ha,P as i,S as ia,Le as j,Bn as ja,we as k,At as ka,m as l,In as la,c as m,W as ma,p as n,Jn as na,fr as o,D as oa,dr as p,ge as pa,mr as q,Be as qa,ut as r,xt as ra,lt as s,Pe as sa,yr as t,Eo as ta,Ie as u,I as v,pt as w,Ar as x,Lr as y,kr as z};//# sourceMappingURL=chunk-RQFW23A2.mjs.map
|
|
43
|
+
//# sourceMappingURL=chunk-RQFW23A2.mjs.map
|