functype 0.8.47 → 0.8.49
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/index.d.ts +302 -8
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -0
- package/package.json +17 -16
- package/dist/chunk-2I2NKDFN.mjs +0 -1
- package/dist/chunk-2ML63TYF.mjs +0 -0
- package/dist/chunk-2U34DUZU.js +0 -1
- package/dist/chunk-377WQNCB.mjs +0 -1
- package/dist/chunk-3VJERXBP.js +0 -1
- package/dist/chunk-44WWBXBL.js +0 -1
- package/dist/chunk-4H62YQ42.mjs +0 -0
- package/dist/chunk-5GE5W3Y5.mjs +0 -1
- package/dist/chunk-5VTXJIR3.js +0 -1
- package/dist/chunk-AKJ5AKY4.js +0 -1
- package/dist/chunk-E6RS47F7.js +0 -1
- package/dist/chunk-HA5XD5KC.mjs +0 -1
- package/dist/chunk-HD6YYUHO.mjs +0 -1
- package/dist/chunk-K3EKBPQE.js +0 -1
- package/dist/chunk-OXLZ6UIZ.js +0 -1
- package/dist/chunk-UAFRIAJN.js +0 -1
- package/dist/chunk-V2J3R5IU.mjs +0 -0
- package/dist/chunk-VK5GL6NM.mjs +0 -1
- package/dist/chunk-WTWWDZY6.js +0 -1
- package/dist/chunk-XORABVON.js +0 -1
- package/dist/chunk-YXECCMSX.mjs +0 -1
- package/dist/chunk-Z6YAH4SC.mjs +0 -1
- package/dist/collections/index.d.mts +0 -8
- package/dist/collections/index.d.ts +0 -8
- package/dist/collections/index.js +0 -1
- package/dist/collections/index.mjs +0 -0
- package/dist/core/base/Base.d.mts +0 -12
- package/dist/core/base/Base.d.ts +0 -12
- package/dist/core/base/Base.js +0 -1
- package/dist/core/base/Base.mjs +0 -1
- package/dist/core/error/Throwable.d.mts +0 -12
- package/dist/core/error/Throwable.d.ts +0 -12
- package/dist/core/error/Throwable.js +0 -1
- package/dist/core/error/Throwable.mjs +0 -1
- package/dist/core/task/Task.d.mts +0 -8
- package/dist/core/task/Task.d.ts +0 -8
- package/dist/core/task/Task.js +0 -1
- package/dist/core/task/Task.mjs +0 -1
- package/dist/either/Either.d.mts +0 -8
- package/dist/either/Either.d.ts +0 -8
- package/dist/either/Either.js +0 -1
- package/dist/either/Either.mjs +0 -1
- package/dist/error/ParseError.d.mts +0 -8
- package/dist/error/ParseError.d.ts +0 -8
- package/dist/error/ParseError.js +0 -1
- package/dist/error/ParseError.mjs +0 -1
- package/dist/functor/index.d.mts +0 -20
- package/dist/functor/index.d.ts +0 -20
- package/dist/functor/index.js +0 -1
- package/dist/functor/index.mjs +0 -1
- package/dist/identity/Identity.d.mts +0 -6
- package/dist/identity/Identity.d.ts +0 -6
- package/dist/identity/Identity.js +0 -1
- package/dist/identity/Identity.mjs +0 -1
- package/dist/index-BSGv2rsm.d.mts +0 -240
- package/dist/index-Cb-cundW.d.ts +0 -240
- package/dist/index.d.mts +0 -8
- package/dist/index.js +0 -1
- package/dist/iterable/index.d.mts +0 -8
- package/dist/iterable/index.d.ts +0 -8
- package/dist/iterable/index.js +0 -1
- package/dist/iterable/index.mjs +0 -1
- package/dist/list/List.d.mts +0 -8
- package/dist/list/List.d.ts +0 -8
- package/dist/list/List.js +0 -1
- package/dist/list/List.mjs +0 -1
- package/dist/map/Map.d.mts +0 -8
- package/dist/map/Map.d.ts +0 -8
- package/dist/map/Map.js +0 -1
- package/dist/map/Map.mjs +0 -1
- package/dist/map/shim.d.mts +0 -4
- package/dist/map/shim.d.ts +0 -4
- package/dist/map/shim.js +0 -1
- package/dist/map/shim.mjs +0 -1
- package/dist/option/Option.d.mts +0 -8
- package/dist/option/Option.d.ts +0 -8
- package/dist/option/Option.js +0 -1
- package/dist/option/Option.mjs +0 -1
- package/dist/serializable/Serializable.d.mts +0 -16
- package/dist/serializable/Serializable.d.ts +0 -16
- package/dist/serializable/Serializable.js +0 -3
- package/dist/serializable/Serializable.mjs +0 -3
- package/dist/set/Set.d.mts +0 -8
- package/dist/set/Set.d.ts +0 -8
- package/dist/set/Set.js +0 -1
- package/dist/set/Set.mjs +0 -1
- package/dist/set/shim.d.mts +0 -4
- package/dist/set/shim.d.ts +0 -4
- package/dist/set/shim.js +0 -1
- package/dist/set/shim.mjs +0 -1
- package/dist/try/Try.d.mts +0 -8
- package/dist/try/Try.d.ts +0 -8
- package/dist/try/Try.js +0 -1
- package/dist/try/Try.mjs +0 -1
- package/dist/tuple/Tuple.d.mts +0 -12
- package/dist/tuple/Tuple.d.ts +0 -12
- package/dist/tuple/Tuple.js +0 -1
- package/dist/tuple/Tuple.mjs +0 -1
- package/dist/typeable/Typeable.d.mts +0 -8
- package/dist/typeable/Typeable.d.ts +0 -8
- package/dist/typeable/Typeable.js +0 -1
- package/dist/typeable/Typeable.mjs +0 -1
- package/dist/util/index.d.mts +0 -13
- package/dist/util/index.d.ts +0 -13
- package/dist/util/index.js +0 -1
- package/dist/util/index.mjs +0 -1
- package/dist/util/isIterable.d.mts +0 -3
- package/dist/util/isIterable.d.ts +0 -3
- package/dist/util/isIterable.js +0 -1
- package/dist/util/isIterable.mjs +0 -1
- package/dist/valuable/Valuable.d.mts +0 -6
- package/dist/valuable/Valuable.d.ts +0 -6
- package/dist/valuable/Valuable.js +0 -1
- package/dist/valuable/Valuable.mjs +0 -1
- package/lib/TaskPromise.d.ts +0 -3
- package/lib/collections/index.d.ts +0 -8
- package/lib/either/Either.d.ts +0 -52
- package/lib/either/EitherT.d.ts +0 -9
- package/lib/error/ParseError.d.ts +0 -6
- package/lib/functor/index.d.ts +0 -15
- package/lib/identity/Identity.d.ts +0 -4
- package/lib/index.d.ts +0 -21
- package/lib/iterable/Seq.d.ts +0 -31
- package/lib/iterable/index.d.ts +0 -22
- package/lib/list/List.d.ts +0 -26
- package/lib/map/Map.d.ts +0 -17
- package/lib/map/shim.d.ts +0 -2
- package/lib/option/Option.d.ts +0 -30
- package/lib/serializable/Serializable.d.ts +0 -15
- package/lib/set/Set.d.ts +0 -15
- package/lib/set/shim.d.ts +0 -2
- package/lib/try/Try.d.ts +0 -18
- package/lib/tuple/Tuple.d.ts +0 -9
- package/lib/typeable/Typeable.d.ts +0 -4
- package/lib/util/index.d.ts +0 -3
- package/lib/util/isIterable.d.ts +0 -1
package/dist/chunk-UAFRIAJN.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunk2U34DUZUjs = require('./chunk-2U34DUZU.js');var _chunk44WWBXBLjs = require('./chunk-44WWBXBL.js');var _chunkAKJ5AKY4js = require('./chunk-AKJ5AKY4.js');var _chunk5VTXJIR3js = require('./chunk-5VTXJIR3.js');var _chunk3VJERXBPjs = require('./chunk-3VJERXBP.js');var _chunkOXLZ6UIZjs = require('./chunk-OXLZ6UIZ.js');var _safestablestringify = require('safe-stable-stringify'); var _safestablestringify2 = _interopRequireDefault(_safestablestringify);var R=e=>{let t=new (0, _chunk3VJERXBPjs.a)(e),r=l(t),o={...r,add:n=>R([...t,n]),remove:n=>{let u=new (0, _chunk3VJERXBPjs.a)(t);return u.delete(n),R(u)},contains:n=>t.has(n),has:n=>t.has(n),map:n=>R(r.map(n)),flatMap:n=>R(r.flatMap(n)),toList:()=>l(t),toSet:()=>o,toString:()=>`Set(${Array.from(t).toString()})`};return o},A= exports.d =e=>R(e);var T=e=>{let t=Array.from(e||[]),r={_tag:"List",[Symbol.iterator]:()=>t[Symbol.iterator](),get size(){return t.length},get length(){return t.length},map:o=>T(t.map(o)),flatMap:o=>T(t.flatMap(n=>Array.from(o(n)))),flatMapAsync:async o=>{let n=await Promise.all(t.map(async u=>await o(u)));return T(n.flatMap(u=>Array.from(u)))},forEach:o=>t.forEach(o),count:o=>t.filter(o).length,exists:o=>t.some(o),filter:o=>T(t.filter(o)),filterNot:o=>T(t.filter(n=>!o(n))),filterType:o=>T(t.filter(n=>_chunkAKJ5AKY4js.b.call(void 0, n,o))),find:(o,n)=>{let u=t.find(d=>o(d)&&(n?_chunkAKJ5AKY4js.b.call(void 0, d,n):!0));return f(u)},get head(){return t[0]},get headOption(){return t.length>0?f(t[0]):L()},get isEmpty(){return t.length===0},toArray:()=>[...t],reduce:o=>t.reduce(o),reduceRight:o=>t.reduceRight(o),foldLeft:o=>n=>t.reduce(n,o),foldRight:o=>n=>t.reduceRight((u,d)=>n(d,u),o),remove:o=>T(t.filter(n=>n!==o)),removeAt:o=>o<0||o>=t.length?r:T([...t.slice(0,o),...t.slice(o+1)]),add:o=>T([...t,o]),get:o=>f(t[o]),concat:o=>T([...t,...o.toArray()]),drop:o=>T(t.slice(o)),dropRight:o=>T(t.slice(0,-o)),dropWhile:o=>T(t.slice(t.findIndex(n=>!o(n)))),flatten:()=>T(t.flatMap(o=>Array.isArray(o)?o:[o])),toList:()=>r,toSet:()=>A(t),toString:()=>`List(${_safestablestringify2.default.call(void 0, t)})`,toValue:()=>({_tag:"List",value:t})};return r},l= exports.e =e=>T(e);var V=e=>({_tag:"Right",value:e,isLeft:()=>!1,isRight:()=>!0,getOrElse:t=>e,getOrThrow:()=>e,map:t=>i(t(e)),mapAsync:t=>t(e).then(r=>i(r)).catch(r=>Promise.resolve(s(r))),merge:t=>t.isLeft()?s(t.value):i([e,t.value]),flatMap:t=>t(e),flatMapAsync:t=>t(e).catch(r=>s(r)),toOption:()=>c(e),toList:()=>l([e]),toString:()=>`Right(${_safestablestringify2.default.call(void 0, e)})`,[Symbol.iterator]:function*(){yield e},yield:function*(){yield e},traverse:t=>{let r=t(e);return r.isLeft()?s(r.value):i([r.value])},lazyMap:function*(t){yield i(t(e))},tap:t=>(t(e),i(e)),tapLeft:t=>i(e),mapLeft:t=>i(e),bimap:(t,r)=>i(r(e)),fold:(t,r)=>r(e),swap:()=>s(e),then:(t,r)=>Promise.resolve(e).then(t,r)}),O=e=>({_tag:"Left",value:e,isLeft:()=>!0,isRight:()=>!1,getOrElse:t=>t,getOrThrow:()=>{throw e},map:t=>s(e),mapAsync:t=>Promise.resolve(s(e)),merge:t=>s(e),flatMap:t=>s(e),flatMapAsync:t=>Promise.resolve(s(e)),toOption:()=>L(),toList:()=>l(),toString:()=>`Left(${_safestablestringify2.default.call(void 0, e)})`,[Symbol.iterator]:function*(){},yield:function*(){},traverse:t=>s(e),lazyMap:function*(t){yield s(e)},tap:t=>s(e),tapLeft:t=>(t(e),s(e)),mapLeft:t=>s(t(e)),bimap:(t,r)=>s(t(e)),fold:(t,r)=>t(e),swap:()=>i(e),then:(t,r)=>Promise.reject(e).then(null,r)}),i= exports.f =e=>V(e),s= exports.g =e=>O(e),me= exports.h =e=>e.isRight(),Re= exports.i =e=>e.isLeft(),he= exports.j =(e,t)=>{try{return i(e())}catch(r){return s(t(r))}},D= exports.k =e=>V(e);console.assert(D);var H=e=>O(e);console.assert(H);var Ae=async(e,t)=>{try{let r=await e();return i(r)}catch(r){return s(t(r))}},J= exports.n ={sequence:e=>{let t=[];for(let r of e){if(r.isLeft())return s(r.value);t.push(r.value)}return i(t)},traverse:(e,t)=>J.sequence(e.map(t)),fromNullable:(e,t)=>e==null?s(t):i(e),fromPredicate:(e,t,r)=>t(e)?i(e):s(r),ap:(e,t)=>e.flatMap(r=>t.map(r)),fromPromise:async(e,t)=>{try{let r=await e;return i(r)}catch(r){return s(t(r))}}};var E=(e,t)=>{let r=_chunk2U34DUZUjs.a.call(void 0, e,t);return{..._chunk44WWBXBLjs.a.call(void 0, "AppException",s(r))}},x= exports.p =e=>({..._chunk44WWBXBLjs.a.call(void 0, "AppResult",i(e))});function K(e,t=o=>o,r=()=>{}){try{return x(e())}catch(o){return E(t(o))}finally{r()}}K.success=e=>x(e);K.fail=e=>E(e);async function k(e,t=o=>o,r=async()=>{}){try{let o=await e();return x(o)}catch(o){let n=await t(o);return E(n)}finally{await r()}}k.success=e=>x(e);k.fail=e=>E(e);var y=e=>{let t={values:new (0, _chunk5VTXJIR3js.a)(e)},r=()=>Array.from(t.values.entries()).map(([a,p])=>_chunkOXLZ6UIZjs.a.call(void 0, [a,p])),o=a=>y(new (0, _chunk5VTXJIR3js.a)(t.values).set(a.toArray()[0],a.toArray()[1]).entries()),n=a=>{let p=new (0, _chunk5VTXJIR3js.a)(t.values);return p.delete(a)?y(p.entries()):y(t.values.entries())},u=a=>t.values.get(a[0])===a[1],d=()=>t.values.size,_=a=>y(Array.from(t.values.entries()).map(([p,j])=>[p,a(j)])),I=a=>{let p=y(t.values.entries()).toList();return y(p.flatMap(a).toArray())},F=a=>l(r()).reduce(a),N=a=>l(r()).reduceRight(a),z=a=>p=>l(r()).foldLeft(a)(p),C=a=>p=>l(r()).foldRight(a)(p),$=a=>f(t.values.get(a)),q=(a,p)=>f(t.values.get(a)).getOrElse(p),G=()=>t.values.size===0;return{add:o,remove:n,contains:u,get size(){return d()},map:_,flatMap:I,reduce:F,reduceRight:N,foldLeft:z,foldRight:C,get:$,getOrElse:q,get isEmpty(){return G()},orElse:(a,p)=>f(t.values.get(a)).orElse(p),toList:()=>l(r()),toSet:()=>A(r()),toString:()=>`Map(${r().toString()})`}},ke= exports.s =e=>y(e);var P=e=>({_tag:"Success",value:e,error:void 0,isSuccess:()=>!0,isFailure:()=>!1,get:()=>e,getOrElse:t=>e,orElse:t=>P(e),orThrow:t=>e,toEither:()=>i(e),map:t=>Q(()=>t(e)),flatMap:t=>t(e),toString:()=>`Success(${_safestablestringify2.default.call(void 0, e)})`}),v=e=>({_tag:"Failure",value:void 0,error:e,isSuccess:()=>!1,isFailure:()=>!0,get:()=>{throw e},getOrElse:t=>t,orElse:t=>t,orThrow:t=>{throw t},toEither:()=>s(e),map:t=>v(e),flatMap:t=>v(e),toString:()=>`Failure(${_safestablestringify2.default.call(void 0, e)}))`}),Q= exports.t =e=>{try{return P(e())}catch(t){return v(t instanceof Error?t:new Error(String(t)))}};var c=e=>({_tag:"Some",value:e,isEmpty:!1,get:()=>e,getOrElse:()=>e,getOrThrow:()=>e,orElse:()=>c(e),orNull:()=>e,map:t=>c(t(e)),filter(t){return t(e)?c(e):m},fold:(t,r)=>r(e),flatMap:t=>t(e),flatMapAsync:async t=>await t(e),reduce:t=>t(void 0,e),reduceRight:t=>t(void 0,e),foldLeft:t=>r=>r(t,e),foldRight:t=>r=>r(e,t),toList:()=>l([e]),contains:t=>t===e,size:1,toEither:t=>i(e),toString:()=>`Some(${_safestablestringify2.default.call(void 0, e)})`,toValue:()=>({_tag:"Some",value:e})}),m={_tag:"None",value:void 0,isEmpty:!0,get:()=>{throw new Error("Cannot call get() on None")},getOrElse:e=>e,getOrThrow(e){throw e},orElse:e=>e,orNull:()=>null,map:e=>m,filter(e){return m},flatMap:e=>m,flatMapAsync:async e=>m,reduce:()=>{},reduceRight:()=>{},fold:(e,t)=>e(),foldLeft:e=>()=>e,foldRight:e=>()=>e,toList:()=>l([]),contains:()=>!1,size:0,toEither:e=>s(e),toString:()=>"None",toValue:()=>({_tag:"None",value:void 0})},L= exports.b =()=>m,f= exports.c =e=>e!=null?c(e):L();f.from=e=>f(e);f.none=()=>L();exports.a = c; exports.b = L; exports.c = f; exports.d = A; exports.e = l; exports.f = i; exports.g = s; exports.h = me; exports.i = Re; exports.j = he; exports.k = D; exports.l = H; exports.m = Ae; exports.n = J; exports.o = E; exports.p = x; exports.q = K; exports.r = k; exports.s = ke; exports.t = Q;
|
package/dist/chunk-V2J3R5IU.mjs
DELETED
|
File without changes
|
package/dist/chunk-VK5GL6NM.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var o=e=>{let r=new Error(e);return r.name="ParseError",r};export{o as a};
|
package/dist/chunk-WTWWDZY6.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/chunk-XORABVON.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/chunk-YXECCMSX.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as B}from"./chunk-HD6YYUHO.mjs";import{a as U}from"./chunk-Z6YAH4SC.mjs";import{b as g}from"./chunk-5GE5W3Y5.mjs";import{a as h}from"./chunk-377WQNCB.mjs";import{a as b}from"./chunk-HA5XD5KC.mjs";import{a as S}from"./chunk-2I2NKDFN.mjs";import X from"safe-stable-stringify";import w from"safe-stable-stringify";import W from"safe-stable-stringify";var R=e=>{let t=new b(e),r=l(t),o={...r,add:n=>R([...t,n]),remove:n=>{let u=new b(t);return u.delete(n),R(u)},contains:n=>t.has(n),has:n=>t.has(n),map:n=>R(r.map(n)),flatMap:n=>R(r.flatMap(n)),toList:()=>l(t),toSet:()=>o,toString:()=>`Set(${Array.from(t).toString()})`};return o},A=e=>R(e);var T=e=>{let t=Array.from(e||[]),r={_tag:"List",[Symbol.iterator]:()=>t[Symbol.iterator](),get size(){return t.length},get length(){return t.length},map:o=>T(t.map(o)),flatMap:o=>T(t.flatMap(n=>Array.from(o(n)))),flatMapAsync:async o=>{let n=await Promise.all(t.map(async u=>await o(u)));return T(n.flatMap(u=>Array.from(u)))},forEach:o=>t.forEach(o),count:o=>t.filter(o).length,exists:o=>t.some(o),filter:o=>T(t.filter(o)),filterNot:o=>T(t.filter(n=>!o(n))),filterType:o=>T(t.filter(n=>g(n,o))),find:(o,n)=>{let u=t.find(d=>o(d)&&(n?g(d,n):!0));return f(u)},get head(){return t[0]},get headOption(){return t.length>0?f(t[0]):L()},get isEmpty(){return t.length===0},toArray:()=>[...t],reduce:o=>t.reduce(o),reduceRight:o=>t.reduceRight(o),foldLeft:o=>n=>t.reduce(n,o),foldRight:o=>n=>t.reduceRight((u,d)=>n(d,u),o),remove:o=>T(t.filter(n=>n!==o)),removeAt:o=>o<0||o>=t.length?r:T([...t.slice(0,o),...t.slice(o+1)]),add:o=>T([...t,o]),get:o=>f(t[o]),concat:o=>T([...t,...o.toArray()]),drop:o=>T(t.slice(o)),dropRight:o=>T(t.slice(0,-o)),dropWhile:o=>T(t.slice(t.findIndex(n=>!o(n)))),flatten:()=>T(t.flatMap(o=>Array.isArray(o)?o:[o])),toList:()=>r,toSet:()=>A(t),toString:()=>`List(${W(t)})`,toValue:()=>({_tag:"List",value:t})};return r},l=e=>T(e);var V=e=>({_tag:"Right",value:e,isLeft:()=>!1,isRight:()=>!0,getOrElse:t=>e,getOrThrow:()=>e,map:t=>i(t(e)),mapAsync:t=>t(e).then(r=>i(r)).catch(r=>Promise.resolve(s(r))),merge:t=>t.isLeft()?s(t.value):i([e,t.value]),flatMap:t=>t(e),flatMapAsync:t=>t(e).catch(r=>s(r)),toOption:()=>c(e),toList:()=>l([e]),toString:()=>`Right(${w(e)})`,[Symbol.iterator]:function*(){yield e},yield:function*(){yield e},traverse:t=>{let r=t(e);return r.isLeft()?s(r.value):i([r.value])},lazyMap:function*(t){yield i(t(e))},tap:t=>(t(e),i(e)),tapLeft:t=>i(e),mapLeft:t=>i(e),bimap:(t,r)=>i(r(e)),fold:(t,r)=>r(e),swap:()=>s(e),then:(t,r)=>Promise.resolve(e).then(t,r)}),O=e=>({_tag:"Left",value:e,isLeft:()=>!0,isRight:()=>!1,getOrElse:t=>t,getOrThrow:()=>{throw e},map:t=>s(e),mapAsync:t=>Promise.resolve(s(e)),merge:t=>s(e),flatMap:t=>s(e),flatMapAsync:t=>Promise.resolve(s(e)),toOption:()=>L(),toList:()=>l(),toString:()=>`Left(${w(e)})`,[Symbol.iterator]:function*(){},yield:function*(){},traverse:t=>s(e),lazyMap:function*(t){yield s(e)},tap:t=>s(e),tapLeft:t=>(t(e),s(e)),mapLeft:t=>s(t(e)),bimap:(t,r)=>s(t(e)),fold:(t,r)=>t(e),swap:()=>i(e),then:(t,r)=>Promise.reject(e).then(null,r)}),i=e=>V(e),s=e=>O(e),me=e=>e.isRight(),Re=e=>e.isLeft(),he=(e,t)=>{try{return i(e())}catch(r){return s(t(r))}},D=e=>V(e);console.assert(D);var H=e=>O(e);console.assert(H);var Ae=async(e,t)=>{try{let r=await e();return i(r)}catch(r){return s(t(r))}},J={sequence:e=>{let t=[];for(let r of e){if(r.isLeft())return s(r.value);t.push(r.value)}return i(t)},traverse:(e,t)=>J.sequence(e.map(t)),fromNullable:(e,t)=>e==null?s(t):i(e),fromPredicate:(e,t,r)=>t(e)?i(e):s(r),ap:(e,t)=>e.flatMap(r=>t.map(r)),fromPromise:async(e,t)=>{try{let r=await e;return i(r)}catch(r){return s(t(r))}}};var E=(e,t)=>{let r=B(e,t);return{...U("AppException",s(r))}},x=e=>({...U("AppResult",i(e))});function K(e,t=o=>o,r=()=>{}){try{return x(e())}catch(o){return E(t(o))}finally{r()}}K.success=e=>x(e);K.fail=e=>E(e);async function k(e,t=o=>o,r=async()=>{}){try{let o=await e();return x(o)}catch(o){let n=await t(o);return E(n)}finally{await r()}}k.success=e=>x(e);k.fail=e=>E(e);var y=e=>{let t={values:new h(e)},r=()=>Array.from(t.values.entries()).map(([a,p])=>S([a,p])),o=a=>y(new h(t.values).set(a.toArray()[0],a.toArray()[1]).entries()),n=a=>{let p=new h(t.values);return p.delete(a)?y(p.entries()):y(t.values.entries())},u=a=>t.values.get(a[0])===a[1],d=()=>t.values.size,_=a=>y(Array.from(t.values.entries()).map(([p,j])=>[p,a(j)])),I=a=>{let p=y(t.values.entries()).toList();return y(p.flatMap(a).toArray())},F=a=>l(r()).reduce(a),N=a=>l(r()).reduceRight(a),z=a=>p=>l(r()).foldLeft(a)(p),C=a=>p=>l(r()).foldRight(a)(p),$=a=>f(t.values.get(a)),q=(a,p)=>f(t.values.get(a)).getOrElse(p),G=()=>t.values.size===0;return{add:o,remove:n,contains:u,get size(){return d()},map:_,flatMap:I,reduce:F,reduceRight:N,foldLeft:z,foldRight:C,get:$,getOrElse:q,get isEmpty(){return G()},orElse:(a,p)=>f(t.values.get(a)).orElse(p),toList:()=>l(r()),toSet:()=>A(r()),toString:()=>`Map(${r().toString()})`}},ke=e=>y(e);import M from"safe-stable-stringify";var P=e=>({_tag:"Success",value:e,error:void 0,isSuccess:()=>!0,isFailure:()=>!1,get:()=>e,getOrElse:t=>e,orElse:t=>P(e),orThrow:t=>e,toEither:()=>i(e),map:t=>Q(()=>t(e)),flatMap:t=>t(e),toString:()=>`Success(${M(e)})`}),v=e=>({_tag:"Failure",value:void 0,error:e,isSuccess:()=>!1,isFailure:()=>!0,get:()=>{throw e},getOrElse:t=>t,orElse:t=>t,orThrow:t=>{throw t},toEither:()=>s(e),map:t=>v(e),flatMap:t=>v(e),toString:()=>`Failure(${M(e)}))`}),Q=e=>{try{return P(e())}catch(t){return v(t instanceof Error?t:new Error(String(t)))}};var c=e=>({_tag:"Some",value:e,isEmpty:!1,get:()=>e,getOrElse:()=>e,getOrThrow:()=>e,orElse:()=>c(e),orNull:()=>e,map:t=>c(t(e)),filter(t){return t(e)?c(e):m},fold:(t,r)=>r(e),flatMap:t=>t(e),flatMapAsync:async t=>await t(e),reduce:t=>t(void 0,e),reduceRight:t=>t(void 0,e),foldLeft:t=>r=>r(t,e),foldRight:t=>r=>r(e,t),toList:()=>l([e]),contains:t=>t===e,size:1,toEither:t=>i(e),toString:()=>`Some(${X(e)})`,toValue:()=>({_tag:"Some",value:e})}),m={_tag:"None",value:void 0,isEmpty:!0,get:()=>{throw new Error("Cannot call get() on None")},getOrElse:e=>e,getOrThrow(e){throw e},orElse:e=>e,orNull:()=>null,map:e=>m,filter(e){return m},flatMap:e=>m,flatMapAsync:async e=>m,reduce:()=>{},reduceRight:()=>{},fold:(e,t)=>e(),foldLeft:e=>()=>e,foldRight:e=>()=>e,toList:()=>l([]),contains:()=>!1,size:0,toEither:e=>s(e),toString:()=>"None",toValue:()=>({_tag:"None",value:void 0})},L=()=>m,f=e=>e!=null?c(e):L();f.from=e=>f(e);f.none=()=>L();export{c as a,L as b,f as c,A as d,l as e,i as f,s as g,me as h,Re as i,he as j,D as k,H as l,Ae as m,J as n,E as o,x as p,K as q,k as r,ke as s,Q as t};
|
package/dist/chunk-Z6YAH4SC.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as t}from"./chunk-5GE5W3Y5.mjs";function o(r,n){return{...t(r,n),toString(){return`${r}()`}}}export{o as a};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { a as Collection, C as Converters } from '../index-BSGv2rsm.mjs';
|
|
2
|
-
import '../functor/index.mjs';
|
|
3
|
-
import '../core/base/Base.mjs';
|
|
4
|
-
import '../core/error/Throwable.mjs';
|
|
5
|
-
import '../typeable/Typeable.mjs';
|
|
6
|
-
import '../identity/Identity.mjs';
|
|
7
|
-
import '../tuple/Tuple.mjs';
|
|
8
|
-
import '../valuable/Valuable.mjs';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { a as Collection, C as Converters } from '../index-Cb-cundW.js';
|
|
2
|
-
import '../functor/index.js';
|
|
3
|
-
import '../core/base/Base.js';
|
|
4
|
-
import '../core/error/Throwable.js';
|
|
5
|
-
import '../typeable/Typeable.js';
|
|
6
|
-
import '../identity/Identity.js';
|
|
7
|
-
import '../tuple/Tuple.js';
|
|
8
|
-
import '../valuable/Valuable.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
File without changes
|
package/dist/core/base/Base.d.ts
DELETED
package/dist/core/base/Base.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk44WWBXBLjs = require('../../chunk-44WWBXBL.js');require('../../chunk-AKJ5AKY4.js');exports.Base = _chunk44WWBXBLjs.a;
|
package/dist/core/base/Base.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"../../chunk-Z6YAH4SC.mjs";import"../../chunk-5GE5W3Y5.mjs";export{a as Base};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Typeable } from '../../typeable/Typeable.mjs';
|
|
2
|
-
|
|
3
|
-
declare const NAME: "Throwable";
|
|
4
|
-
type Throwable = Error & Typeable<typeof NAME> & {
|
|
5
|
-
readonly data?: unknown;
|
|
6
|
-
};
|
|
7
|
-
declare const Throwable: {
|
|
8
|
-
(srcError: unknown, data?: unknown): Throwable;
|
|
9
|
-
NAME: "Throwable";
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export { Throwable };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Typeable } from '../../typeable/Typeable.js';
|
|
2
|
-
|
|
3
|
-
declare const NAME: "Throwable";
|
|
4
|
-
type Throwable = Error & Typeable<typeof NAME> & {
|
|
5
|
-
readonly data?: unknown;
|
|
6
|
-
};
|
|
7
|
-
declare const Throwable: {
|
|
8
|
-
(srcError: unknown, data?: unknown): Throwable;
|
|
9
|
-
NAME: "Throwable";
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export { Throwable };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2U34DUZUjs = require('../../chunk-2U34DUZU.js');exports.Throwable = _chunk2U34DUZUjs.a;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"../../chunk-HD6YYUHO.mjs";export{a as Throwable};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { A as AppException, h as AppResult, k as AsyncTask, j as Task } from '../../index-BSGv2rsm.mjs';
|
|
2
|
-
import '../error/Throwable.mjs';
|
|
3
|
-
import '../../functor/index.mjs';
|
|
4
|
-
import '../base/Base.mjs';
|
|
5
|
-
import '../../identity/Identity.mjs';
|
|
6
|
-
import '../../tuple/Tuple.mjs';
|
|
7
|
-
import '../../typeable/Typeable.mjs';
|
|
8
|
-
import '../../valuable/Valuable.mjs';
|
package/dist/core/task/Task.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { A as AppException, h as AppResult, k as AsyncTask, j as Task } from '../../index-Cb-cundW.js';
|
|
2
|
-
import '../error/Throwable.js';
|
|
3
|
-
import '../../functor/index.js';
|
|
4
|
-
import '../base/Base.js';
|
|
5
|
-
import '../../identity/Identity.js';
|
|
6
|
-
import '../../tuple/Tuple.js';
|
|
7
|
-
import '../../typeable/Typeable.js';
|
|
8
|
-
import '../../valuable/Valuable.js';
|
package/dist/core/task/Task.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkUAFRIAJNjs = require('../../chunk-UAFRIAJN.js');require('../../chunk-2U34DUZU.js');require('../../chunk-44WWBXBL.js');require('../../chunk-AKJ5AKY4.js');require('../../chunk-5VTXJIR3.js');require('../../chunk-3VJERXBP.js');require('../../chunk-OXLZ6UIZ.js');require('../../chunk-K3EKBPQE.js');require('../../chunk-XORABVON.js');require('../../chunk-WTWWDZY6.js');exports.AppException = _chunkUAFRIAJNjs.o; exports.AppResult = _chunkUAFRIAJNjs.p; exports.AsyncTask = _chunkUAFRIAJNjs.r; exports.Task = _chunkUAFRIAJNjs.q;
|
package/dist/core/task/Task.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as a,p as b,q as c,r as d}from"../../chunk-YXECCMSX.mjs";import"../../chunk-HD6YYUHO.mjs";import"../../chunk-Z6YAH4SC.mjs";import"../../chunk-5GE5W3Y5.mjs";import"../../chunk-377WQNCB.mjs";import"../../chunk-HA5XD5KC.mjs";import"../../chunk-2I2NKDFN.mjs";import"../../chunk-2ML63TYF.mjs";import"../../chunk-V2J3R5IU.mjs";import"../../chunk-4H62YQ42.mjs";export{a as AppException,b as AppResult,d as AsyncTask,c as Task};
|
package/dist/either/Either.d.mts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import '../functor/index.mjs';
|
|
2
|
-
export { E as Either, c as Left, R as Right, T as TestEither, f as TypeCheckLeft, e as TypeCheckRight, d as isLeft, i as isRight, t as tryCatch, g as tryCatchAsync } from '../index-BSGv2rsm.mjs';
|
|
3
|
-
import '../typeable/Typeable.mjs';
|
|
4
|
-
import '../core/base/Base.mjs';
|
|
5
|
-
import '../core/error/Throwable.mjs';
|
|
6
|
-
import '../identity/Identity.mjs';
|
|
7
|
-
import '../tuple/Tuple.mjs';
|
|
8
|
-
import '../valuable/Valuable.mjs';
|
package/dist/either/Either.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import '../functor/index.js';
|
|
2
|
-
export { E as Either, c as Left, R as Right, T as TestEither, f as TypeCheckLeft, e as TypeCheckRight, d as isLeft, i as isRight, t as tryCatch, g as tryCatchAsync } from '../index-Cb-cundW.js';
|
|
3
|
-
import '../typeable/Typeable.js';
|
|
4
|
-
import '../core/base/Base.js';
|
|
5
|
-
import '../core/error/Throwable.js';
|
|
6
|
-
import '../identity/Identity.js';
|
|
7
|
-
import '../tuple/Tuple.js';
|
|
8
|
-
import '../valuable/Valuable.js';
|
package/dist/either/Either.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkUAFRIAJNjs = require('../chunk-UAFRIAJN.js');require('../chunk-2U34DUZU.js');require('../chunk-44WWBXBL.js');require('../chunk-AKJ5AKY4.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-K3EKBPQE.js');require('../chunk-XORABVON.js');require('../chunk-WTWWDZY6.js');exports.Either = _chunkUAFRIAJNjs.n; exports.Left = _chunkUAFRIAJNjs.g; exports.Right = _chunkUAFRIAJNjs.f; exports.TypeCheckLeft = _chunkUAFRIAJNjs.l; exports.TypeCheckRight = _chunkUAFRIAJNjs.k; exports.isLeft = _chunkUAFRIAJNjs.i; exports.isRight = _chunkUAFRIAJNjs.h; exports.tryCatch = _chunkUAFRIAJNjs.j; exports.tryCatchAsync = _chunkUAFRIAJNjs.m;
|
package/dist/either/Either.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as a,g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i}from"../chunk-YXECCMSX.mjs";import"../chunk-HD6YYUHO.mjs";import"../chunk-Z6YAH4SC.mjs";import"../chunk-5GE5W3Y5.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-2ML63TYF.mjs";import"../chunk-V2J3R5IU.mjs";import"../chunk-4H62YQ42.mjs";export{i as Either,b as Left,a as Right,g as TypeCheckLeft,f as TypeCheckRight,d as isLeft,c as isRight,e as tryCatch,h as tryCatchAsync};
|
package/dist/error/ParseError.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkE6RS47F7js = require('../chunk-E6RS47F7.js');exports.ParseError = _chunkE6RS47F7js.a;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"../chunk-VK5GL6NM.mjs";export{a as ParseError};
|
package/dist/functor/index.d.mts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
type SingleType = unknown;
|
|
2
|
-
type ArrayType = SingleType[];
|
|
3
|
-
type Type = SingleType | ArrayType;
|
|
4
|
-
type AbstractFunctor<A extends Type> = {
|
|
5
|
-
map(f: (value: A) => Type): AbstractFunctor<Type>;
|
|
6
|
-
flatMap(f: (value: A) => AbstractFunctor<Type>): AbstractFunctor<Type>;
|
|
7
|
-
};
|
|
8
|
-
type Functor<A extends Type> = AbstractFunctor<A> & {
|
|
9
|
-
map<B extends Type>(f: (value: A) => B): Functor<B>;
|
|
10
|
-
flatMap<B extends Type>(f: (value: A) => Functor<B>): Functor<B>;
|
|
11
|
-
};
|
|
12
|
-
type AsyncFunctor<A extends Type> = {
|
|
13
|
-
flatMapAsync(f: (value: A) => PromiseLike<AsyncFunctor<A>>): PromiseLike<AsyncFunctor<A>>;
|
|
14
|
-
};
|
|
15
|
-
type ArrayFunctor<A extends ArrayType> = AbstractFunctor<A> & {
|
|
16
|
-
map<U extends ArrayType>(f: (value: A) => U): ArrayFunctor<U>;
|
|
17
|
-
flatMap<U extends ArrayType>(f: (value: A) => ArrayFunctor<U>): ArrayFunctor<U>;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export type { AbstractFunctor, ArrayFunctor, ArrayType, AsyncFunctor, Functor, SingleType, Type };
|
package/dist/functor/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
type SingleType = unknown;
|
|
2
|
-
type ArrayType = SingleType[];
|
|
3
|
-
type Type = SingleType | ArrayType;
|
|
4
|
-
type AbstractFunctor<A extends Type> = {
|
|
5
|
-
map(f: (value: A) => Type): AbstractFunctor<Type>;
|
|
6
|
-
flatMap(f: (value: A) => AbstractFunctor<Type>): AbstractFunctor<Type>;
|
|
7
|
-
};
|
|
8
|
-
type Functor<A extends Type> = AbstractFunctor<A> & {
|
|
9
|
-
map<B extends Type>(f: (value: A) => B): Functor<B>;
|
|
10
|
-
flatMap<B extends Type>(f: (value: A) => Functor<B>): Functor<B>;
|
|
11
|
-
};
|
|
12
|
-
type AsyncFunctor<A extends Type> = {
|
|
13
|
-
flatMapAsync(f: (value: A) => PromiseLike<AsyncFunctor<A>>): PromiseLike<AsyncFunctor<A>>;
|
|
14
|
-
};
|
|
15
|
-
type ArrayFunctor<A extends ArrayType> = AbstractFunctor<A> & {
|
|
16
|
-
map<U extends ArrayType>(f: (value: A) => U): ArrayFunctor<U>;
|
|
17
|
-
flatMap<U extends ArrayType>(f: (value: A) => ArrayFunctor<U>): ArrayFunctor<U>;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export type { AbstractFunctor, ArrayFunctor, ArrayType, AsyncFunctor, Functor, SingleType, Type };
|
package/dist/functor/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";require('../chunk-XORABVON.js');
|
package/dist/functor/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"../chunk-V2J3R5IU.mjs";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";require('../chunk-K3EKBPQE.js');
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"../chunk-2ML63TYF.mjs";
|
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import { Type, Functor, AsyncFunctor } from './functor/index.mjs';
|
|
2
|
-
import './core/base/Base.mjs';
|
|
3
|
-
import { Throwable } from './core/error/Throwable.mjs';
|
|
4
|
-
import './identity/Identity.mjs';
|
|
5
|
-
import { Tuple } from './tuple/Tuple.mjs';
|
|
6
|
-
import { Typeable, ExtractTag } from './typeable/Typeable.mjs';
|
|
7
|
-
import { Valuable } from './valuable/Valuable.mjs';
|
|
8
|
-
|
|
9
|
-
declare const Some: <T extends Type>(value: T) => Option<T>;
|
|
10
|
-
declare const None: <T extends Type>() => Option<T>;
|
|
11
|
-
type Option<T extends Type> = {
|
|
12
|
-
readonly _tag: "Some" | "None";
|
|
13
|
-
readonly value: T | undefined;
|
|
14
|
-
isEmpty: boolean;
|
|
15
|
-
get(): T;
|
|
16
|
-
getOrElse(defaultValue: T): T;
|
|
17
|
-
getOrThrow(error: Error): T;
|
|
18
|
-
orElse(alternative: Option<T>): Option<T>;
|
|
19
|
-
orNull(): T | null;
|
|
20
|
-
map<U extends Type>(f: (value: T) => U): Option<U>;
|
|
21
|
-
filter(predicate: (value: T) => boolean): Option<T>;
|
|
22
|
-
flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
|
|
23
|
-
flatMapAsync<U extends Type>(f: (value: T) => Promise<Option<U>>): Promise<Option<U>>;
|
|
24
|
-
reduce<U>(f: (acc: U, value: T) => U): U;
|
|
25
|
-
reduceRight<U>(f: (acc: U, value: T) => U): U;
|
|
26
|
-
fold<U>(onNone: () => U, onSome: (value: T) => U): U;
|
|
27
|
-
foldLeft<B>(z: B): (op: (b: B, a: T) => B) => B;
|
|
28
|
-
foldRight<B>(z: B): (op: (a: T, b: B) => B) => B;
|
|
29
|
-
toList(): List<T>;
|
|
30
|
-
contains(value: T): boolean;
|
|
31
|
-
size: number;
|
|
32
|
-
toEither<E>(left: E): Either<E, T>;
|
|
33
|
-
toString(): string;
|
|
34
|
-
toValue(): {
|
|
35
|
-
_tag: "Some" | "None";
|
|
36
|
-
value: T;
|
|
37
|
-
};
|
|
38
|
-
} & (Traversable<T> & Functor<T> & Typeable<"Some" | "None"> & Valuable<T> & AsyncFunctor<T>);
|
|
39
|
-
declare const Option: {
|
|
40
|
-
<T extends Type>(value: T | null | undefined): Option<T>;
|
|
41
|
-
from<T>(value: T): Option<T>;
|
|
42
|
-
none<T>(): Option<T>;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
type IterableType<A extends Type> = {
|
|
46
|
-
count(p: (x: A) => boolean): number;
|
|
47
|
-
find(p: (a: A) => boolean): Option<A>;
|
|
48
|
-
forEach(f: (a: A) => void): void;
|
|
49
|
-
drop(n: number): IterableType<A>;
|
|
50
|
-
dropRight(n: number): IterableType<A>;
|
|
51
|
-
dropWhile(p: (a: A) => boolean): IterableType<A>;
|
|
52
|
-
exists(p: (a: A) => boolean): boolean;
|
|
53
|
-
filter(p: (a: A) => boolean): IterableType<A>;
|
|
54
|
-
filterNot(p: (a: A) => boolean): IterableType<A>;
|
|
55
|
-
flatten<B>(): IterableType<B>;
|
|
56
|
-
reduce(f: (b: A, a: A) => A): A;
|
|
57
|
-
reduceRight(f: (b: A, a: A) => A): A;
|
|
58
|
-
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
59
|
-
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
60
|
-
get head(): A;
|
|
61
|
-
get headOption(): Option<A>;
|
|
62
|
-
get isEmpty(): boolean;
|
|
63
|
-
map<B extends Type>(f: (a: A) => B): IterableType<B>;
|
|
64
|
-
flatMap<B extends Type>(f: (a: A) => IterableType<B>): IterableType<B>;
|
|
65
|
-
get size(): number;
|
|
66
|
-
toArray<B = A>(): readonly B[];
|
|
67
|
-
toValue: () => {
|
|
68
|
-
_tag: string;
|
|
69
|
-
value: A[];
|
|
70
|
-
};
|
|
71
|
-
} & Iterable<A> & Functor<A> & AsyncFunctor<A>;
|
|
72
|
-
|
|
73
|
-
type Converters<A> = {
|
|
74
|
-
toList(): List<A>;
|
|
75
|
-
toSet(): Set<A>;
|
|
76
|
-
toString(): string;
|
|
77
|
-
};
|
|
78
|
-
type Collection<A> = Converters<A>;
|
|
79
|
-
|
|
80
|
-
type Set<A> = {
|
|
81
|
-
add: (value: A) => Set<A>;
|
|
82
|
-
remove: (value: A) => Set<A>;
|
|
83
|
-
contains: (value: A) => boolean;
|
|
84
|
-
has: (value: A) => boolean;
|
|
85
|
-
map: <B>(f: (a: A) => B) => Set<B>;
|
|
86
|
-
flatMap: <B>(f: (a: A) => IterableType<B>) => Set<B>;
|
|
87
|
-
toList: () => List<A>;
|
|
88
|
-
toSet: () => Set<A>;
|
|
89
|
-
toString: () => string;
|
|
90
|
-
} & IterableType<A> & Collection<A>;
|
|
91
|
-
declare const Set: <A>(iterable?: Iterable<A> | IterableType<A>) => Set<A>;
|
|
92
|
-
|
|
93
|
-
type List<A> = {
|
|
94
|
-
readonly length: number;
|
|
95
|
-
readonly [Symbol.iterator]: () => Iterator<A>;
|
|
96
|
-
map: <B>(f: (a: A) => B) => List<B>;
|
|
97
|
-
flatMap: <B>(f: (a: A) => IterableType<B>) => List<B>;
|
|
98
|
-
flatMapAsync: <B>(f: (a: A) => PromiseLike<IterableType<B>>) => PromiseLike<List<B>>;
|
|
99
|
-
forEach: (f: (a: A) => void) => void;
|
|
100
|
-
count: (p: (x: A) => boolean) => number;
|
|
101
|
-
exists: (p: (a: A) => boolean) => boolean;
|
|
102
|
-
filter<S extends A>(predicate: (a: A) => a is S): List<S>;
|
|
103
|
-
filter(predicate: (a: A) => unknown): List<A>;
|
|
104
|
-
filterNot: (p: (a: A) => boolean) => List<A>;
|
|
105
|
-
filterType: <T extends Typeable<string, unknown>>(tag: string) => List<T & A>;
|
|
106
|
-
find: <T extends A = A>(predicate: (a: A) => boolean, tag?: ExtractTag<T>) => Option<T>;
|
|
107
|
-
readonly head: A;
|
|
108
|
-
readonly headOption: Option<A>;
|
|
109
|
-
readonly isEmpty: boolean;
|
|
110
|
-
toArray: <B = A>() => B[];
|
|
111
|
-
reduce: (f: (prev: A, curr: A) => A) => A;
|
|
112
|
-
reduceRight: (f: (prev: A, curr: A) => A) => A;
|
|
113
|
-
foldLeft: <B>(z: B) => (op: (b: B, a: A) => B) => B;
|
|
114
|
-
foldRight: <B>(z: B) => (op: (a: A, b: B) => B) => B;
|
|
115
|
-
remove: (value: A) => List<A>;
|
|
116
|
-
removeAt: (index: number) => List<A>;
|
|
117
|
-
add: (item: A) => List<A>;
|
|
118
|
-
get: (index: number) => Option<A>;
|
|
119
|
-
concat: (other: List<A>) => List<A>;
|
|
120
|
-
toList: () => List<A>;
|
|
121
|
-
toSet: () => Set<A>;
|
|
122
|
-
toString: () => string;
|
|
123
|
-
toValue: () => {
|
|
124
|
-
_tag: string;
|
|
125
|
-
value: A[];
|
|
126
|
-
};
|
|
127
|
-
} & IterableType<A> & Typeable<"List"> & AsyncFunctor<A>;
|
|
128
|
-
declare const List: <A>(values?: Iterable<A>) => List<A>;
|
|
129
|
-
|
|
130
|
-
type TestEither<L extends Type, R extends Type> = Either<L, R> & Functor<R> & AsyncFunctor<R>;
|
|
131
|
-
declare const Right: <L extends Type, R extends Type>(value: R) => Either<L, R>;
|
|
132
|
-
declare const Left: <L extends Type, R extends Type>(value: L) => Either<L, R>;
|
|
133
|
-
declare const isRight: <L extends Type, R extends Type>(either: Either<L, R>) => either is Either<L, R> & {
|
|
134
|
-
value: R;
|
|
135
|
-
};
|
|
136
|
-
declare const isLeft: <L extends Type, R extends Type>(either: Either<L, R>) => either is Either<L, R> & {
|
|
137
|
-
value: L;
|
|
138
|
-
};
|
|
139
|
-
declare const tryCatch: <L extends Type, R extends Type>(f: () => R, onError: (error: unknown) => L) => Either<L, R>;
|
|
140
|
-
declare const TypeCheckRight: <L extends Type, R extends Type>(value: R) => TestEither<L, R>;
|
|
141
|
-
declare const TypeCheckLeft: <L extends Type, R extends Type>(value: L) => TestEither<L, R>;
|
|
142
|
-
declare const tryCatchAsync: <L extends Type, R extends Type>(f: () => Promise<R>, onError: (error: unknown) => L) => Promise<Either<L, R>>;
|
|
143
|
-
type Either<L extends Type, R extends Type> = {
|
|
144
|
-
readonly _tag: "Left" | "Right";
|
|
145
|
-
value: L | R;
|
|
146
|
-
isLeft: () => boolean;
|
|
147
|
-
isRight: () => boolean;
|
|
148
|
-
getOrElse: (defaultValue: R) => R;
|
|
149
|
-
getOrThrow: () => R;
|
|
150
|
-
map: <U extends Type>(f: (value: R) => U) => Either<L, U>;
|
|
151
|
-
merge: <L1 extends Type, R1 extends Type>(other: Either<L1, R1>) => Either<L | L1, [R, R1]>;
|
|
152
|
-
mapAsync: <U extends Type>(f: (value: R) => Promise<U>) => Promise<Either<L, U>>;
|
|
153
|
-
flatMap: <U extends Type>(f: (value: R) => Either<L, U>) => Either<L, U>;
|
|
154
|
-
flatMapAsync: <U extends Type>(f: (value: R) => Promise<Either<L, U>>) => Promise<Either<L, U>>;
|
|
155
|
-
toOption: () => Option<R>;
|
|
156
|
-
toList: () => List<R>;
|
|
157
|
-
toString: () => string;
|
|
158
|
-
[Symbol.iterator]: () => Iterator<R>;
|
|
159
|
-
yield: () => Generator<R, void, unknown>;
|
|
160
|
-
traverse: <U extends Type>(f: (value: R) => Either<L, U>) => Either<L, U[]>;
|
|
161
|
-
lazyMap: <U extends Type>(f: (value: R) => U) => Generator<Either<L, U>, void, unknown>;
|
|
162
|
-
tap: (f: (value: R) => void) => Either<L, R>;
|
|
163
|
-
tapLeft: (f: (value: L) => void) => Either<L, R>;
|
|
164
|
-
mapLeft: <L2 extends Type>(f: (value: L) => L2) => Either<L2, R>;
|
|
165
|
-
bimap: <L2 extends Type, R2 extends Type>(fl: (value: L) => L2, fr: (value: R) => R2) => Either<L2, R2>;
|
|
166
|
-
fold: <T extends Type>(onLeft: (value: L) => T, onRight: (value: R) => T) => T;
|
|
167
|
-
swap: () => Either<R, L>;
|
|
168
|
-
} & Typeable<"Left" | "Right"> & PromiseLike<R> & AsyncFunctor<R>;
|
|
169
|
-
declare const Either: {
|
|
170
|
-
sequence: <L extends Type, R extends Type>(eithers: Either<L, R>[]) => Either<L, R[]>;
|
|
171
|
-
traverse: <L extends Type, R extends Type, U extends Type>(arr: R[], f: (value: R) => Either<L, U>) => Either<L, U[]>;
|
|
172
|
-
fromNullable: <L extends Type, R extends Type>(value: R | null | undefined, leftValue: L) => Either<L, R>;
|
|
173
|
-
fromPredicate: <L extends Type, R extends Type>(value: R, predicate: (value: R) => boolean, leftValue: L) => Either<L, R>;
|
|
174
|
-
ap: <L extends Type, R extends Type, U extends Type>(eitherF: Either<L, (value: R) => U>, eitherV: Either<L, R>) => Either<L, U>;
|
|
175
|
-
fromPromise: <L, R>(promise: Promise<R>, onRejected: (reason: unknown) => L) => Promise<Either<L, R>>;
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
type AppException<T> = Either<Throwable, T>;
|
|
179
|
-
/**
|
|
180
|
-
* AppException factory function
|
|
181
|
-
* @param error
|
|
182
|
-
* @param data
|
|
183
|
-
* @constructor
|
|
184
|
-
*/
|
|
185
|
-
declare const AppException: <T>(error: unknown, data?: unknown) => AppException<T>;
|
|
186
|
-
type AppResult<T> = Either<Throwable, T>;
|
|
187
|
-
declare const AppResult: <T>(data: T) => AppResult<T>;
|
|
188
|
-
type Task<T> = Either<Throwable, T>;
|
|
189
|
-
declare function Task<T>(t: () => T, e?: (error: unknown) => unknown, f?: () => void): Task<T>;
|
|
190
|
-
declare namespace Task {
|
|
191
|
-
var success: <T>(data: T) => AppResult<T>;
|
|
192
|
-
var fail: <T>(error: unknown) => AppException<T>;
|
|
193
|
-
}
|
|
194
|
-
type AsyncTask<T> = Promise<Task<T>>;
|
|
195
|
-
declare function AsyncTask<T>(t: () => T, e?: (error: unknown) => unknown, f?: () => Promise<void> | void): AsyncTask<T>;
|
|
196
|
-
declare namespace AsyncTask {
|
|
197
|
-
var success: <T>(data: T) => AppResult<T>;
|
|
198
|
-
var fail: <T>(error: unknown) => AppException<T>;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
type SafeTraversable<K, V> = Omit<Traversable<Tuple<[K, V]>>, "map" | "flatMap">;
|
|
202
|
-
type Map<K, V> = {
|
|
203
|
-
add(item: Tuple<[K, V]>): Map<K, V>;
|
|
204
|
-
remove(value: K): Map<K, V>;
|
|
205
|
-
map<U>(f: (value: V) => U): Map<K, U>;
|
|
206
|
-
flatMap<K2, V2>(f: (entry: Tuple<[K, V]>) => IterableType<[K2, V2]>): Map<K2, V2>;
|
|
207
|
-
get(key: K): Option<V>;
|
|
208
|
-
getOrElse(key: K, defaultValue: V): V;
|
|
209
|
-
orElse(key: K, alternative: Option<V>): Option<V>;
|
|
210
|
-
} & SafeTraversable<K, V> & Collection<Tuple<[K, V]>>;
|
|
211
|
-
declare const Map: <K, V>(entries?: readonly (readonly [K, V])[] | IterableIterator<[K, V]> | null) => Map<K, V>;
|
|
212
|
-
|
|
213
|
-
type Try<T> = {
|
|
214
|
-
readonly _tag: "Success" | "Failure";
|
|
215
|
-
readonly value: T | undefined;
|
|
216
|
-
readonly error: Error | undefined;
|
|
217
|
-
isSuccess: () => boolean;
|
|
218
|
-
isFailure: () => boolean;
|
|
219
|
-
get: () => T;
|
|
220
|
-
getOrElse: (defaultValue: T) => T;
|
|
221
|
-
orElse: (alternative: Try<T>) => Try<T>;
|
|
222
|
-
orThrow: (error: Error) => T;
|
|
223
|
-
toEither: () => Either<Error, T>;
|
|
224
|
-
map: <U>(f: (value: T) => U) => Try<U>;
|
|
225
|
-
flatMap: <U>(f: (value: T) => Try<U>) => Try<U>;
|
|
226
|
-
toString: () => string;
|
|
227
|
-
} & Typeable<"Success" | "Failure">;
|
|
228
|
-
declare const Try: <T>(f: () => T) => Try<T>;
|
|
229
|
-
|
|
230
|
-
type Traversable<A extends Type> = Functor<A> & {
|
|
231
|
-
get size(): number;
|
|
232
|
-
get isEmpty(): boolean;
|
|
233
|
-
contains(value: A): boolean;
|
|
234
|
-
reduce(f: (b: A, a: A) => A): A;
|
|
235
|
-
reduceRight(f: (b: A, a: A) => A): A;
|
|
236
|
-
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
237
|
-
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
export { AppException as A, type Converters as C, Either as E, type IterableType as I, List as L, Map as M, None as N, Option as O, Right as R, Some as S, type TestEither as T, type Collection as a, Set as b, Left as c, isLeft as d, TypeCheckRight as e, TypeCheckLeft as f, tryCatchAsync as g, AppResult as h, isRight as i, Task as j, AsyncTask as k, Try as l, type Traversable as m, tryCatch as t };
|