functype 0.14.2 → 0.14.3
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-BSiHxaKK.d.ts → Either-DpoF3l-y.d.ts} +4 -1
- package/dist/{chunk-E23BUTN4.mjs → chunk-GMC6UNBM.mjs} +2 -2
- package/dist/chunk-GMC6UNBM.mjs.map +1 -0
- 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
- package/dist/chunk-E23BUTN4.mjs.map +0 -1
|
@@ -31,9 +31,12 @@ type DoResult<T> = {
|
|
|
31
31
|
/**
|
|
32
32
|
* Interface for types that support Do-notation
|
|
33
33
|
* Implementing this interface allows a type to be yielded in Do-comprehensions
|
|
34
|
+
*
|
|
35
|
+
* Using a mapped type with 'as const' assertion to work around TypeScript's
|
|
36
|
+
* limitation with unique symbols in declaration files (TS4023)
|
|
34
37
|
*/
|
|
35
38
|
interface DoProtocol<T> {
|
|
36
|
-
[DO_PROTOCOL]: () => DoResult<T>;
|
|
39
|
+
readonly [DO_PROTOCOL]: () => DoResult<T>;
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
/**
|
|
@@ -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 ho(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,Rn as fa,x as g,An as ga,$t as h,kn as ha,P as i,S as ia,Le as j,On as ja,we as k,At as ka,m as l,Vn as la,c as m,W as ma,p as n,$n 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,ho 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,Rn as fa,x as g,An as ga,$t as h,kn as ha,P as i,S as ia,Le as j,On as ja,we as k,At as ka,m as l,Vn as la,c as m,W as ma,p as n,$n 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,ho as ta,Ie as u,I as v,pt as w,Ar as x,Lr as y,kr as z};//# sourceMappingURL=chunk-GMC6UNBM.mjs.map
|
|
43
|
+
//# sourceMappingURL=chunk-GMC6UNBM.mjs.map
|