functype 0.4.2 → 0.8.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/README.md +3 -3
- package/dist/chunk-2I2NKDFN.mjs +1 -0
- package/dist/chunk-6GSI27WU.js +1 -0
- package/dist/chunk-AB3QRD66.js +1 -0
- package/dist/chunk-BSQMHA7A.js +1 -0
- package/dist/chunk-E6RS47F7.js +1 -0
- package/dist/chunk-I7TGEFK5.mjs +1 -0
- package/dist/chunk-JQ7HMWOT.mjs +1 -0
- package/dist/chunk-N3GTVYCO.js +1 -0
- package/dist/chunk-O7DO2OKU.mjs +1 -0
- package/dist/chunk-OWW7KOUW.mjs +1 -0
- package/dist/chunk-OXLZ6UIZ.js +1 -0
- package/dist/chunk-PJIXAQSQ.mjs +1 -0
- package/dist/chunk-Q65ZRGZH.js +1 -0
- package/dist/chunk-VK5GL6NM.mjs +1 -0
- package/dist/collections/index.d.mts +2 -2
- package/dist/collections/index.d.ts +2 -2
- package/dist/either/Either.d.mts +2 -2
- package/dist/either/Either.d.ts +2 -2
- package/dist/either/Either.js +1 -1
- package/dist/either/Either.mjs +1 -1
- package/dist/error/ParseError.d.mts +6 -2
- package/dist/error/ParseError.d.ts +6 -2
- package/dist/error/ParseError.js +1 -1
- package/dist/error/ParseError.mjs +1 -1
- package/dist/functor/index.d.mts +11 -11
- package/dist/functor/index.d.ts +11 -11
- package/dist/index-5xp8zYMn.d.mts +183 -0
- package/dist/index-8YakfACG.d.ts +183 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/iterable/Seq.d.mts +2 -2
- package/dist/iterable/Seq.d.ts +2 -2
- package/dist/iterable/Seq.js +1 -1
- package/dist/iterable/Seq.mjs +1 -1
- package/dist/iterable/index.d.mts +2 -2
- package/dist/iterable/index.d.ts +2 -2
- package/dist/iterable/index.js +1 -1
- package/dist/iterable/index.mjs +1 -1
- package/dist/list/List.d.mts +2 -2
- package/dist/list/List.d.ts +2 -2
- package/dist/list/List.js +1 -1
- package/dist/list/List.mjs +1 -1
- package/dist/map/Map.d.mts +2 -2
- package/dist/map/Map.d.ts +2 -2
- package/dist/map/Map.js +1 -1
- package/dist/map/Map.mjs +1 -1
- package/dist/map/shim.js +1 -1
- package/dist/map/shim.mjs +1 -1
- package/dist/option/Option.d.mts +2 -2
- package/dist/option/Option.d.ts +2 -2
- package/dist/option/Option.js +1 -1
- package/dist/option/Option.mjs +1 -1
- package/dist/set/Set.d.mts +2 -2
- package/dist/set/Set.d.ts +2 -2
- package/dist/set/Set.js +1 -1
- package/dist/set/Set.mjs +1 -1
- package/dist/set/shim.js +1 -1
- package/dist/set/shim.mjs +1 -1
- package/dist/try/Try.d.mts +2 -2
- package/dist/try/Try.d.ts +2 -2
- package/dist/try/Try.js +1 -1
- package/dist/try/Try.mjs +1 -1
- package/dist/tuple/Tuple.d.mts +7 -15
- package/dist/tuple/Tuple.d.ts +7 -15
- package/dist/tuple/Tuple.js +1 -1
- package/dist/tuple/Tuple.mjs +1 -1
- package/dist/typeable/Typeable.d.mts +6 -0
- package/dist/typeable/Typeable.d.ts +6 -0
- package/dist/{chunk-ZTL76QDL.js → typeable/Typeable.js} +1 -1
- package/dist/typeable/Typeable.mjs +1 -0
- package/dist/util/index.d.mts +2 -2
- package/dist/util/index.d.ts +2 -2
- package/dist/util/index.js +1 -1
- package/dist/util/index.mjs +1 -1
- package/dist/util/isIterable.d.mts +1 -1
- package/dist/util/isIterable.d.ts +1 -1
- package/dist/util/isIterable.js +1 -1
- package/dist/util/isIterable.mjs +1 -1
- package/lib/collections/index.d.ts +6 -6
- package/lib/either/Either.d.ts +25 -29
- package/lib/either/index.d.ts +1 -1
- package/lib/error/ParseError.d.ts +6 -2
- package/lib/functor/index.d.ts +10 -10
- package/lib/index.d.ts +9 -9
- package/lib/iterable/Seq.d.ts +27 -24
- package/lib/iterable/index.d.ts +7 -7
- package/lib/list/List.d.ts +20 -22
- package/lib/list/index.d.ts +4 -3
- package/lib/map/Map.d.ts +15 -35
- package/lib/map/index.d.ts +1 -1
- package/lib/option/Option.d.ts +25 -40
- package/lib/option/index.d.ts +6 -5
- package/lib/set/Set.d.ts +15 -18
- package/lib/set/index.d.ts +1 -1
- package/lib/try/Try.d.ts +21 -19
- package/lib/try/index.d.ts +1 -1
- package/lib/tuple/Tuple.d.ts +6 -13
- package/lib/tuple/index.d.ts +5 -1
- package/lib/typeable/Typeable.d.ts +4 -0
- package/lib/util/index.d.ts +1 -1
- package/lib/util/isIterable.d.ts +1 -1
- package/package.json +9 -9
- package/dist/chunk-2XH6TPQK.mjs +0 -1
- package/dist/chunk-35UIDXTO.js +0 -1
- package/dist/chunk-3APFKSCC.js +0 -1
- package/dist/chunk-3EH27NX2.js +0 -1
- package/dist/chunk-3OHJLCSR.mjs +0 -0
- package/dist/chunk-6BEXQNLZ.js +0 -1
- package/dist/chunk-74TKYQJS.mjs +0 -0
- package/dist/chunk-BYDMB2VV.js +0 -1
- package/dist/chunk-CFYIJKWF.mjs +0 -1
- package/dist/chunk-GTO34VMN.mjs +0 -1
- package/dist/chunk-HC3O3O2B.mjs +0 -1
- package/dist/chunk-HOO2EPER.mjs +0 -1
- package/dist/chunk-IC6AOOR5.mjs +0 -1
- package/dist/chunk-JR557W27.mjs +0 -1
- package/dist/chunk-KY3WKBLM.mjs +0 -1
- package/dist/chunk-O2XFH626.js +0 -1
- package/dist/chunk-Q4H3PCBH.mjs +0 -0
- package/dist/chunk-QQAQYRPV.js +0 -1
- package/dist/chunk-RM3O3IPT.js +0 -1
- package/dist/chunk-SKJIJETA.js +0 -1
- package/dist/chunk-T7AA7TJX.mjs +0 -1
- package/dist/chunk-TYHKMGLC.mjs +0 -1
- package/dist/chunk-V5UFW2E4.js +0 -1
- package/dist/chunk-XVHCBGUW.js +0 -1
- package/dist/chunk-ZOH672YH.js +0 -1
- package/dist/either/index.d.mts +0 -4
- package/dist/either/index.d.ts +0 -4
- package/dist/either/index.js +0 -1
- package/dist/either/index.mjs +0 -1
- package/dist/index-Dbjb4MUT.d.ts +0 -232
- package/dist/index-UMWeD2QH.d.mts +0 -232
- package/dist/list/index.d.mts +0 -4
- package/dist/list/index.d.ts +0 -4
- package/dist/list/index.js +0 -1
- package/dist/list/index.mjs +0 -1
- package/dist/map/index.d.mts +0 -4
- package/dist/map/index.d.ts +0 -4
- package/dist/map/index.js +0 -1
- package/dist/map/index.mjs +0 -1
- package/dist/option/index.d.mts +0 -4
- package/dist/option/index.d.ts +0 -4
- package/dist/option/index.js +0 -1
- package/dist/option/index.mjs +0 -1
- package/dist/set/index.d.mts +0 -4
- package/dist/set/index.d.ts +0 -4
- package/dist/set/index.js +0 -1
- package/dist/set/index.mjs +0 -1
- package/dist/try/index.d.mts +0 -4
- package/dist/try/index.d.ts +0 -4
- package/dist/try/index.js +0 -1
- package/dist/try/index.mjs +0 -1
- package/dist/tuple/index.d.mts +0 -8
- package/dist/tuple/index.d.ts +0 -8
- package/dist/tuple/index.js +0 -1
- package/dist/tuple/index.mjs +0 -1
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
## functype
|
|
2
|
-
|
|
3
|
-
A small functional library for TypeScript
|
|
1
|
+
## functype
|
|
2
|
+
|
|
3
|
+
A small functional library for TypeScript
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=r=>({map:e=>{let t=e(r);return n(t)},flatMap:e=>e(r),get:e=>r[e],toArray:()=>r,[Symbol.iterator](){let e=0;return{next:()=>e<r.length?{value:r[e++],done:!1}:{value:void 0,done:!0}}}});export{n as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5VTXJIR3js = require('./chunk-5VTXJIR3.js');var _chunkOXLZ6UIZjs = require('./chunk-OXLZ6UIZ.js');var _chunkN3GTVYCOjs = require('./chunk-N3GTVYCO.js');var _chunkAB3QRD66js = require('./chunk-AB3QRD66.js');var o=n=>{let a={values:new (0, _chunk5VTXJIR3js.a)(n)},r=()=>Array.from(a.values.entries()).map(([e,t])=>_chunkOXLZ6UIZjs.a.call(void 0, [e,t])),i=e=>o(new (0, _chunk5VTXJIR3js.a)(a.values).set(e.toArray()[0],e.toArray()[1]).entries()),c=e=>{let t=new (0, _chunk5VTXJIR3js.a)(a.values);return t.delete(e)?o(t.entries()):o(a.values.entries())},m=e=>a.values.get(e[0])===e[1],f=()=>a.values.size,v=e=>o(Array.from(a.values.entries()).map(([t,O])=>[t,e(O)])),M=e=>{let t=o(a.values.entries()).toList();return o(t.flatMap(e).toArray())},T=e=>_chunkAB3QRD66js.e.call(void 0, r()).reduce(e),g=e=>_chunkAB3QRD66js.e.call(void 0, r()).reduceRight(e),y=e=>t=>_chunkAB3QRD66js.e.call(void 0, r()).foldLeft(e)(t),d=e=>t=>_chunkAB3QRD66js.e.call(void 0, r()).foldRight(e)(t),S=e=>_chunkAB3QRD66js.c.call(void 0, a.values.get(e)),b=(e,t)=>_chunkAB3QRD66js.c.call(void 0, a.values.get(e)).getOrElse(t),E=()=>a.values.size===0;return{add:i,remove:c,contains:m,get size(){return f()},map:v,flatMap:M,reduce:T,reduceRight:g,foldLeft:y,foldRight:d,get:S,getOrElse:b,get isEmpty(){return E()},orElse:(e,t)=>_chunkAB3QRD66js.c.call(void 0, a.values.get(e)).orElse(t),toList:()=>_chunkN3GTVYCOjs.b.call(void 0, r()),toSet:()=>_chunkN3GTVYCOjs.a.call(void 0, r()),toString:()=>`Map(${r().toString()})`}},C= exports.a =n=>o(n);exports.a = C;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBNNK42JCjs = require('./chunk-BNNK42JC.js');var n=e=>{let r=_chunkBNNK42JCjs.a.call(void 0, e)?e:e instanceof Object&&"toArray"in e?e.toArray():[],t=Array.from(r);return{[Symbol.iterator]:()=>t[Symbol.iterator](),get length(){return t.length},map:o=>n(t.map(o)),flatMap:o=>n(t.flatMap(a=>o(a).toArray())),forEach:o=>t.forEach(o),count:o=>t.filter(o).length,exists:o=>t.some(o),filter:o=>n(t.filter(o)),filterNot:o=>n(t.filter(a=>!o(a))),find:o=>i(t.find(o)),get head(){return t[0]},get headOption(){return t.length>0?i(t[0]):p()},get isEmpty(){return t.length===0},get size(){return t.length},toArray:()=>[...t],reduce:o=>t.reduce(o),reduceRight:o=>t.reduceRight(o),foldLeft:o=>a=>t.reduce(a,o),foldRight:o=>a=>t.reduceRight((B,b)=>a(b,B),o),valueOf:()=>({values:t})}},l= exports.e =e=>n(e);var A=e=>({_tag:"Some",value:e,isEmpty:!1,get:()=>e,getOrElse:()=>e,orElse:()=>A(e),map:r=>A(r(e)),flatMap:r=>r(e),reduce:r=>r(void 0,e),reduceRight:r=>r(void 0,e),foldLeft:r=>t=>t(r,e),foldRight:r=>t=>t(e,r),toList:()=>l([e]),contains:r=>r===e,size:1,valueOf:()=>({_tag:"Some",value:e}),toString:()=>`Some(${JSON.stringify(e)})`}),f={_tag:"None",value:void 0,isEmpty:!0,get:()=>{throw new Error("Cannot call get() on None")},getOrElse:e=>e,orElse:e=>e,map:()=>f,flatMap:()=>f,reduce:()=>{},reduceRight:()=>{},foldLeft:e=>()=>e,foldRight:e=>()=>e,toList:()=>l([]),contains:()=>!1,size:0,valueOf:()=>({_tag:"None"}),toString:()=>"None"},p= exports.b =()=>f,i= exports.c =e=>e!=null?A(e):p();exports.a = A; exports.b = p; exports.c = i; exports.d = n; exports.e = l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkN3GTVYCOjs = require('./chunk-N3GTVYCO.js');var _chunkAB3QRD66js = require('./chunk-AB3QRD66.js');var R=t=>({_tag:"Right",value:t,isLeft:()=>!1,isRight:()=>!0,map:e=>R(e(t)),flatMap:e=>e(t),toOption:()=>_chunkAB3QRD66js.a.call(void 0, t),toList:()=>_chunkN3GTVYCOjs.b.call(void 0, [t]),valueOf:()=>({_tag:"Right",value:t}),toString:()=>`Right(${JSON.stringify(t)})`}),r=t=>({_tag:"Left",value:t,isLeft:()=>!0,isRight:()=>!1,map:e=>r(t),flatMap:e=>r(t),toOption:()=>_chunkAB3QRD66js.b.call(void 0, ),toList:()=>_chunkN3GTVYCOjs.b.call(void 0, ),valueOf:()=>({_tag:"Left",value:t}),toString:()=>`Left(${JSON.stringify(t)})`}),s= exports.a =t=>R(t),h= exports.b =t=>r(t),g= exports.c =t=>t.isRight(),U= exports.d =t=>t.isLeft(),E= exports.e =(t,e)=>{try{return s(t())}catch(n){return h(e(n))}};exports.a = s; exports.b = h; exports.c = g; exports.d = U; exports.e = E;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var o=e=>{let r=new Error(e);return r.name="ParseError",r};exports.a = o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as m}from"./chunk-HA5XD5KC.mjs";import{c as S,e as l}from"./chunk-O7DO2OKU.mjs";import{a as b}from"./chunk-RRAIFS3D.mjs";var n=o=>{function A(t){return t!=null&&typeof t[Symbol.iterator]=="function"}let e=Array.isArray(o)?o:A(o)?Array.from(o):[],i=l(e),r={...i,length:e.length,map:t=>n(e.map(t)),flatMap:t=>n(i.flatMap(t)),remove:t=>{let a=e.indexOf(t);return r.removeAt(a)},contains:t=>e.includes(t),add:t=>n([...e,t]),removeAt:t=>t<0||t>=e.length?r:n([...e.slice(0,t),...e.slice(t+1)]),get:t=>S(e[t]),concat:t=>n([...e,...t.toArray()]),toList:()=>r,toSet:()=>c(e),toString:()=>`List(${e.toString()})`};return new Proxy(r,{get(t,a){return typeof a=="symbol"||isNaN(Number(a))?t[a]:t.get(Number(a))}})},L=o=>n(o);var s=o=>{let A=b(o)?new m(o):new m(o?.toArray()??[]),e=l(A),i={...e,add:r=>s([...A,r]),remove:r=>{let t=new m(A);return t.delete(r),s(t)},contains:r=>A.has(r),has:r=>A.has(r),map:r=>s(e.map(r)),flatMap:r=>s(e.flatMap(r)),toList:()=>L(A),toSet:()=>i,toString:()=>`Set(${Array.from(A).toString()})`};return i},c=o=>s(o);export{c as a,L as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b as T}from"./chunk-PJIXAQSQ.mjs";var s=r=>({_tag:"Success",value:r,error:void 0,isSuccess:()=>!0,isFailure:()=>!1,getOrElse:e=>r,orElse:e=>s(r),toEither:()=>a(r),map:e=>l(()=>e(r)),flatMap:e=>e(r),valueOf:()=>({_tag:"Success",value:r}),toString:()=>`Success(${JSON.stringify(r)})`}),t=r=>({_tag:"Failure",value:void 0,error:r,isSuccess:()=>!1,isFailure:()=>!0,getOrElse:e=>e,orElse:e=>e,toEither:()=>T(r),map:e=>t(r),flatMap:e=>t(r),valueOf:()=>({_tag:"Failure",error:r}),toString:()=>`Failure(${r.message})`}),l=r=>{try{return s(r())}catch(e){return t(e instanceof Error?e:new Error(String(e)))}};export{l as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk3VJERXBPjs = require('./chunk-3VJERXBP.js');var _chunkAB3QRD66js = require('./chunk-AB3QRD66.js');var _chunkBNNK42JCjs = require('./chunk-BNNK42JC.js');var n=o=>{function A(t){return t!=null&&typeof t[Symbol.iterator]=="function"}let e=Array.isArray(o)?o:A(o)?Array.from(o):[],i=_chunkAB3QRD66js.e.call(void 0, e),r={...i,length:e.length,map:t=>n(e.map(t)),flatMap:t=>n(i.flatMap(t)),remove:t=>{let a=e.indexOf(t);return r.removeAt(a)},contains:t=>e.includes(t),add:t=>n([...e,t]),removeAt:t=>t<0||t>=e.length?r:n([...e.slice(0,t),...e.slice(t+1)]),get:t=>_chunkAB3QRD66js.c.call(void 0, e[t]),concat:t=>n([...e,...t.toArray()]),toList:()=>r,toSet:()=>c(e),toString:()=>`List(${e.toString()})`};return new Proxy(r,{get(t,a){return typeof a=="symbol"||isNaN(Number(a))?t[a]:t.get(Number(a))}})},L= exports.b =o=>n(o);var s=o=>{let A=_chunkBNNK42JCjs.a.call(void 0, o)?new (0, _chunk3VJERXBPjs.a)(o):new (0, _chunk3VJERXBPjs.a)(_nullishCoalesce(_optionalChain([o, 'optionalAccess', _ => _.toArray, 'call', _2 => _2()]), () => ([]))),e=_chunkAB3QRD66js.e.call(void 0, A),i={...e,add:r=>s([...A,r]),remove:r=>{let t=new (0, _chunk3VJERXBPjs.a)(A);return t.delete(r),s(t)},contains:r=>A.has(r),has:r=>A.has(r),map:r=>s(e.map(r)),flatMap:r=>s(e.flatMap(r)),toList:()=>L(A),toSet:()=>i,toString:()=>`Set(${Array.from(A).toString()})`};return i},c= exports.a =o=>s(o);exports.a = c; exports.b = L;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as d}from"./chunk-RRAIFS3D.mjs";var n=e=>{let r=d(e)?e:e instanceof Object&&"toArray"in e?e.toArray():[],t=Array.from(r);return{[Symbol.iterator]:()=>t[Symbol.iterator](),get length(){return t.length},map:o=>n(t.map(o)),flatMap:o=>n(t.flatMap(a=>o(a).toArray())),forEach:o=>t.forEach(o),count:o=>t.filter(o).length,exists:o=>t.some(o),filter:o=>n(t.filter(o)),filterNot:o=>n(t.filter(a=>!o(a))),find:o=>i(t.find(o)),get head(){return t[0]},get headOption(){return t.length>0?i(t[0]):p()},get isEmpty(){return t.length===0},get size(){return t.length},toArray:()=>[...t],reduce:o=>t.reduce(o),reduceRight:o=>t.reduceRight(o),foldLeft:o=>a=>t.reduce(a,o),foldRight:o=>a=>t.reduceRight((B,b)=>a(b,B),o),valueOf:()=>({values:t})}},l=e=>n(e);var A=e=>({_tag:"Some",value:e,isEmpty:!1,get:()=>e,getOrElse:()=>e,orElse:()=>A(e),map:r=>A(r(e)),flatMap:r=>r(e),reduce:r=>r(void 0,e),reduceRight:r=>r(void 0,e),foldLeft:r=>t=>t(r,e),foldRight:r=>t=>t(e,r),toList:()=>l([e]),contains:r=>r===e,size:1,valueOf:()=>({_tag:"Some",value:e}),toString:()=>`Some(${JSON.stringify(e)})`}),f={_tag:"None",value:void 0,isEmpty:!0,get:()=>{throw new Error("Cannot call get() on None")},getOrElse:e=>e,orElse:e=>e,map:()=>f,flatMap:()=>f,reduce:()=>{},reduceRight:()=>{},foldLeft:e=>()=>e,foldRight:e=>()=>e,toList:()=>l([]),contains:()=>!1,size:0,valueOf:()=>({_tag:"None"}),toString:()=>"None"},p=()=>f,i=e=>e!=null?A(e):p();export{A as a,p as b,i as c,n as d,l as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as s}from"./chunk-377WQNCB.mjs";import{a as u}from"./chunk-2I2NKDFN.mjs";import{a as V,b as K}from"./chunk-I7TGEFK5.mjs";import{c as p,e as l}from"./chunk-O7DO2OKU.mjs";var o=n=>{let a={values:new s(n)},r=()=>Array.from(a.values.entries()).map(([e,t])=>u([e,t])),i=e=>o(new s(a.values).set(e.toArray()[0],e.toArray()[1]).entries()),c=e=>{let t=new s(a.values);return t.delete(e)?o(t.entries()):o(a.values.entries())},m=e=>a.values.get(e[0])===e[1],f=()=>a.values.size,v=e=>o(Array.from(a.values.entries()).map(([t,O])=>[t,e(O)])),M=e=>{let t=o(a.values.entries()).toList();return o(t.flatMap(e).toArray())},T=e=>l(r()).reduce(e),g=e=>l(r()).reduceRight(e),y=e=>t=>l(r()).foldLeft(e)(t),d=e=>t=>l(r()).foldRight(e)(t),S=e=>p(a.values.get(e)),b=(e,t)=>p(a.values.get(e)).getOrElse(t),E=()=>a.values.size===0;return{add:i,remove:c,contains:m,get size(){return f()},map:v,flatMap:M,reduce:T,reduceRight:g,foldLeft:y,foldRight:d,get:S,getOrElse:b,get isEmpty(){return E()},orElse:(e,t)=>p(a.values.get(e)).orElse(t),toList:()=>K(r()),toSet:()=>V(r()),toString:()=>`Map(${r().toString()})`}},C=n=>o(n);export{C as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var n=r=>({map:e=>{let t=e(r);return n(t)},flatMap:e=>e(r),get:e=>r[e],toArray:()=>r,[Symbol.iterator](){let e=0;return{next:()=>e<r.length?{value:r[e++],done:!1}:{value:void 0,done:!0}}}});exports.a = n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as i}from"./chunk-I7TGEFK5.mjs";import{a as L,b as o}from"./chunk-O7DO2OKU.mjs";var R=t=>({_tag:"Right",value:t,isLeft:()=>!1,isRight:()=>!0,map:e=>R(e(t)),flatMap:e=>e(t),toOption:()=>L(t),toList:()=>i([t]),valueOf:()=>({_tag:"Right",value:t}),toString:()=>`Right(${JSON.stringify(t)})`}),r=t=>({_tag:"Left",value:t,isLeft:()=>!0,isRight:()=>!1,map:e=>r(t),flatMap:e=>r(t),toOption:()=>o(),toList:()=>i(),valueOf:()=>({_tag:"Left",value:t}),toString:()=>`Left(${JSON.stringify(t)})`}),s=t=>R(t),h=t=>r(t),g=t=>t.isRight(),U=t=>t.isLeft(),E=(t,e)=>{try{return s(t())}catch(n){return h(e(n))}};export{s as a,h as b,g as c,U as d,E as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBSQMHA7Ajs = require('./chunk-BSQMHA7A.js');var s=r=>({_tag:"Success",value:r,error:void 0,isSuccess:()=>!0,isFailure:()=>!1,getOrElse:e=>r,orElse:e=>s(r),toEither:()=>_chunkBSQMHA7Ajs.a.call(void 0, r),map:e=>l(()=>e(r)),flatMap:e=>e(r),valueOf:()=>({_tag:"Success",value:r}),toString:()=>`Success(${JSON.stringify(r)})`}),t=r=>({_tag:"Failure",value:void 0,error:r,isSuccess:()=>!1,isFailure:()=>!0,getOrElse:e=>e,orElse:e=>e,toEither:()=>_chunkBSQMHA7Ajs.b.call(void 0, r),map:e=>t(r),flatMap:e=>t(r),valueOf:()=>({_tag:"Failure",error:r}),toString:()=>`Failure(${r.message})`}),l= exports.a =r=>{try{return s(r())}catch(e){return t(e instanceof Error?e:new Error(String(e)))}};exports.a = l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=e=>{let r=new Error(e);return r.name="ParseError",r};export{o as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { d as Collection, C as Converters } from '../index-5xp8zYMn.mjs';
|
|
2
2
|
import '../functor/index.mjs';
|
|
3
3
|
import '../tuple/Tuple.mjs';
|
|
4
|
-
import '../
|
|
4
|
+
import '../typeable/Typeable.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { d as Collection, C as Converters } from '../index-8YakfACG.js';
|
|
2
2
|
import '../functor/index.js';
|
|
3
3
|
import '../tuple/Tuple.js';
|
|
4
|
-
import '../
|
|
4
|
+
import '../typeable/Typeable.js';
|
package/dist/either/Either.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { E as Either, h as Left, R as Right } from '../index-UMWeD2QH.mjs';
|
|
2
1
|
import '../functor/index.mjs';
|
|
2
|
+
export { E as Either, e as Left, R as Right, f as isLeft, i as isRight, t as tryCatch } from '../index-5xp8zYMn.mjs';
|
|
3
|
+
import '../typeable/Typeable.mjs';
|
|
3
4
|
import '../tuple/Tuple.mjs';
|
|
4
|
-
import '../tuple/index.mjs';
|
package/dist/either/Either.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { E as Either, h as Left, R as Right } from '../index-Dbjb4MUT.js';
|
|
2
1
|
import '../functor/index.js';
|
|
2
|
+
export { E as Either, e as Left, R as Right, f as isLeft, i as isRight, t as tryCatch } from '../index-8YakfACG.js';
|
|
3
|
+
import '../typeable/Typeable.js';
|
|
3
4
|
import '../tuple/Tuple.js';
|
|
4
|
-
import '../tuple/index.js';
|
package/dist/either/Either.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBSQMHA7Ajs = require('../chunk-BSQMHA7A.js');require('../chunk-N3GTVYCO.js');require('../chunk-3VJERXBP.js');require('../chunk-AB3QRD66.js');require('../chunk-BNNK42JC.js');exports.Left = _chunkBSQMHA7Ajs.b; exports.Right = _chunkBSQMHA7Ajs.a; exports.isLeft = _chunkBSQMHA7Ajs.d; exports.isRight = _chunkBSQMHA7Ajs.c; exports.tryCatch = _chunkBSQMHA7Ajs.e;
|
package/dist/either/Either.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e}from"../chunk-PJIXAQSQ.mjs";import"../chunk-I7TGEFK5.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-O7DO2OKU.mjs";import"../chunk-RRAIFS3D.mjs";export{b as Left,a as Right,d as isLeft,c as isRight,e as tryCatch};
|
package/dist/error/ParseError.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkE6RS47F7js = require('../chunk-E6RS47F7.js');exports.ParseError = _chunkE6RS47F7js.a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-VK5GL6NM.mjs";export{a as ParseError};
|
package/dist/functor/index.d.mts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
type SingleType =
|
|
1
|
+
type SingleType = unknown;
|
|
2
2
|
type ArrayType = SingleType[];
|
|
3
3
|
type Type = SingleType | ArrayType;
|
|
4
|
-
type
|
|
5
|
-
map(f: (value: A) => Type):
|
|
6
|
-
flatMap(f: (value: A) =>
|
|
4
|
+
type AbstractFunctor<A extends Type> = {
|
|
5
|
+
map(f: (value: A) => Type): AbstractFunctor<Type>;
|
|
6
|
+
flatMap(f: (value: A) => AbstractFunctor<Type>): AbstractFunctor<Type>;
|
|
7
7
|
};
|
|
8
|
-
type
|
|
9
|
-
map<B extends Type>(f: (value: A) => B):
|
|
10
|
-
flatMap<B extends Type>(f: (value: A) =>
|
|
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
11
|
};
|
|
12
|
-
type
|
|
13
|
-
map<U extends ArrayType>(f: (value: A) => U):
|
|
14
|
-
flatMap<U extends ArrayType>(f: (value: A) =>
|
|
12
|
+
type ArrayFunctor<A extends ArrayType> = AbstractFunctor<A> & {
|
|
13
|
+
map<U extends ArrayType>(f: (value: A) => U): ArrayFunctor<U>;
|
|
14
|
+
flatMap<U extends ArrayType>(f: (value: A) => ArrayFunctor<U>): ArrayFunctor<U>;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export type {
|
|
17
|
+
export type { AbstractFunctor, ArrayFunctor, ArrayType, Functor, SingleType, Type };
|
package/dist/functor/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
type SingleType =
|
|
1
|
+
type SingleType = unknown;
|
|
2
2
|
type ArrayType = SingleType[];
|
|
3
3
|
type Type = SingleType | ArrayType;
|
|
4
|
-
type
|
|
5
|
-
map(f: (value: A) => Type):
|
|
6
|
-
flatMap(f: (value: A) =>
|
|
4
|
+
type AbstractFunctor<A extends Type> = {
|
|
5
|
+
map(f: (value: A) => Type): AbstractFunctor<Type>;
|
|
6
|
+
flatMap(f: (value: A) => AbstractFunctor<Type>): AbstractFunctor<Type>;
|
|
7
7
|
};
|
|
8
|
-
type
|
|
9
|
-
map<B extends Type>(f: (value: A) => B):
|
|
10
|
-
flatMap<B extends Type>(f: (value: A) =>
|
|
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
11
|
};
|
|
12
|
-
type
|
|
13
|
-
map<U extends ArrayType>(f: (value: A) => U):
|
|
14
|
-
flatMap<U extends ArrayType>(f: (value: A) =>
|
|
12
|
+
type ArrayFunctor<A extends ArrayType> = AbstractFunctor<A> & {
|
|
13
|
+
map<U extends ArrayType>(f: (value: A) => U): ArrayFunctor<U>;
|
|
14
|
+
flatMap<U extends ArrayType>(f: (value: A) => ArrayFunctor<U>): ArrayFunctor<U>;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export type {
|
|
17
|
+
export type { AbstractFunctor, ArrayFunctor, ArrayType, Functor, SingleType, Type };
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { Type, Functor } from './functor/index.mjs';
|
|
2
|
+
import { Tuple } from './tuple/Tuple.mjs';
|
|
3
|
+
import { Typeable } from './typeable/Typeable.mjs';
|
|
4
|
+
|
|
5
|
+
declare const Some: <T extends Type>(value: T) => Option<T>;
|
|
6
|
+
declare const None: <T extends Type>() => Option<T>;
|
|
7
|
+
type Option<T extends Type> = {
|
|
8
|
+
readonly _tag: "Some" | "None";
|
|
9
|
+
readonly value: T | undefined;
|
|
10
|
+
isEmpty: boolean;
|
|
11
|
+
get(): T;
|
|
12
|
+
getOrElse(defaultValue: T): T;
|
|
13
|
+
orElse(alternative: Option<T>): Option<T>;
|
|
14
|
+
map<U extends Type>(f: (value: T) => U): Option<U>;
|
|
15
|
+
flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
|
|
16
|
+
reduce<U>(f: (acc: U, value: T) => U): U;
|
|
17
|
+
reduceRight<U>(f: (acc: U, value: T) => U): U;
|
|
18
|
+
foldLeft<B>(z: B): (op: (b: B, a: T) => B) => B;
|
|
19
|
+
foldRight<B>(z: B): (op: (a: T, b: B) => B) => B;
|
|
20
|
+
toList(): _Iterable_<T>;
|
|
21
|
+
contains(value: T): boolean;
|
|
22
|
+
size: number;
|
|
23
|
+
valueOf(): {
|
|
24
|
+
_tag: "Some" | "None";
|
|
25
|
+
value?: T;
|
|
26
|
+
};
|
|
27
|
+
toString(): string;
|
|
28
|
+
} & Traversable<T> & Functor<T> & Typeable<"Some" | "None">;
|
|
29
|
+
declare const Option: <T extends Type>(value: T | null | undefined) => Option<T>;
|
|
30
|
+
|
|
31
|
+
declare const createSeq: <A>(values?: Iterable<A> | _Iterable_<A>) => Seq<A>;
|
|
32
|
+
type Seq<A> = {
|
|
33
|
+
readonly length: number;
|
|
34
|
+
readonly [Symbol.iterator]: () => Iterator<A>;
|
|
35
|
+
map: <B>(f: (a: A) => B) => Seq<B>;
|
|
36
|
+
flatMap: <B>(f: (a: A) => _Iterable_<B>) => Seq<B>;
|
|
37
|
+
forEach: (f: (a: A) => void) => void;
|
|
38
|
+
count: (p: (x: A) => boolean) => number;
|
|
39
|
+
exists: (p: (a: A) => boolean) => boolean;
|
|
40
|
+
filter: (p: (a: A) => boolean) => Seq<A>;
|
|
41
|
+
filterNot: (p: (a: A) => boolean) => Seq<A>;
|
|
42
|
+
find: (p: (a: A) => boolean) => Option<A>;
|
|
43
|
+
readonly head: A;
|
|
44
|
+
readonly headOption: Option<A>;
|
|
45
|
+
readonly isEmpty: boolean;
|
|
46
|
+
readonly size: number;
|
|
47
|
+
toArray: () => A[];
|
|
48
|
+
reduce: (f: (prev: A, curr: A) => A) => A;
|
|
49
|
+
reduceRight: (f: (prev: A, curr: A) => A) => A;
|
|
50
|
+
foldLeft: <B>(z: B) => (op: (b: B, a: A) => B) => B;
|
|
51
|
+
foldRight: <B>(z: B) => (op: (a: A, b: B) => B) => B;
|
|
52
|
+
valueOf: () => {
|
|
53
|
+
values: A[];
|
|
54
|
+
};
|
|
55
|
+
} & _Iterable_<A>;
|
|
56
|
+
declare const Seq: <A>(values?: Iterable<A> | _Iterable_<A>) => Seq<A>;
|
|
57
|
+
|
|
58
|
+
type _Iterable_<A extends Type> = {
|
|
59
|
+
count(p: (x: A) => boolean): number;
|
|
60
|
+
find(p: (a: A) => boolean): Option<A>;
|
|
61
|
+
forEach(f: (a: A) => void): void;
|
|
62
|
+
exists(p: (a: A) => boolean): boolean;
|
|
63
|
+
filter(p: (a: A) => boolean): _Iterable_<A>;
|
|
64
|
+
filterNot(p: (a: A) => boolean): _Iterable_<A>;
|
|
65
|
+
reduce(f: (b: A, a: A) => A): A;
|
|
66
|
+
reduceRight(f: (b: A, a: A) => A): A;
|
|
67
|
+
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
68
|
+
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
69
|
+
get head(): A;
|
|
70
|
+
get headOption(): Option<A>;
|
|
71
|
+
get isEmpty(): boolean;
|
|
72
|
+
map<B extends Type>(f: (a: A) => B): _Iterable_<B>;
|
|
73
|
+
flatMap<B extends Type>(f: (a: A) => _Iterable_<B> | Iterable<B>): _Iterable_<B>;
|
|
74
|
+
get size(): number;
|
|
75
|
+
toArray(): readonly A[];
|
|
76
|
+
} & Functor<A>;
|
|
77
|
+
|
|
78
|
+
type Set<A> = {
|
|
79
|
+
add: (value: A) => Set<A>;
|
|
80
|
+
remove: (value: A) => Set<A>;
|
|
81
|
+
contains: (value: A) => boolean;
|
|
82
|
+
has: (value: A) => boolean;
|
|
83
|
+
map: <B>(f: (a: A) => B) => Set<B>;
|
|
84
|
+
flatMap: <B>(f: (a: A) => _Iterable_<B>) => Set<B>;
|
|
85
|
+
toList: () => List<A>;
|
|
86
|
+
toSet: () => Set<A>;
|
|
87
|
+
toString: () => string;
|
|
88
|
+
} & _Iterable_<A> & Collection<A>;
|
|
89
|
+
declare const Set: <A>(iterable?: Iterable<A> | _Iterable_<A>) => Set<A>;
|
|
90
|
+
|
|
91
|
+
type Converters<A> = {
|
|
92
|
+
toList(): List<A>;
|
|
93
|
+
toSet(): Set<A>;
|
|
94
|
+
toString(): string;
|
|
95
|
+
};
|
|
96
|
+
type Collection<A> = Converters<A>;
|
|
97
|
+
|
|
98
|
+
type List<A> = {
|
|
99
|
+
add: (item: A) => List<A>;
|
|
100
|
+
map: <B>(f: (a: A) => B) => List<B>;
|
|
101
|
+
flatMap: <B>(f: (a: A) => _Iterable_<B>) => List<B>;
|
|
102
|
+
remove: (value: A) => List<A>;
|
|
103
|
+
contains: (value: A) => boolean;
|
|
104
|
+
removeAt: (index: number) => List<A>;
|
|
105
|
+
get: (index: number) => Option<A>;
|
|
106
|
+
concat: (other: List<A>) => List<A>;
|
|
107
|
+
toList: () => List<A>;
|
|
108
|
+
toSet: () => Set<A>;
|
|
109
|
+
toString: () => string;
|
|
110
|
+
valueOf: () => {
|
|
111
|
+
values: A[];
|
|
112
|
+
};
|
|
113
|
+
} & ArrayLike<A> & _Iterable_<A> & Collection<A>;
|
|
114
|
+
declare const List: <A>(values?: Iterable<A> | _Iterable_<A>) => List<A>;
|
|
115
|
+
|
|
116
|
+
type Either<L extends Type, R extends Type> = {
|
|
117
|
+
readonly _tag: "Left" | "Right";
|
|
118
|
+
value: L | R;
|
|
119
|
+
isLeft: () => boolean;
|
|
120
|
+
isRight: () => boolean;
|
|
121
|
+
map: <U extends Type>(f: (value: R) => U) => Either<L, U>;
|
|
122
|
+
flatMap: <U extends Type>(f: (value: R) => Either<L, U>) => Either<L, U>;
|
|
123
|
+
toOption: () => Option<R>;
|
|
124
|
+
toList: () => List<R>;
|
|
125
|
+
valueOf: () => {
|
|
126
|
+
_tag: "Left" | "Right";
|
|
127
|
+
value: L | R;
|
|
128
|
+
};
|
|
129
|
+
toString: () => string;
|
|
130
|
+
} & Functor<R> & Typeable<"Left" | "Right">;
|
|
131
|
+
declare const Right: <L, R>(value: R) => Either<L, R>;
|
|
132
|
+
declare const Left: <L, R>(value: L) => Either<L, R>;
|
|
133
|
+
declare const isRight: <L, R>(either: Either<L, R>) => either is Either<L, R> & {
|
|
134
|
+
value: R;
|
|
135
|
+
};
|
|
136
|
+
declare const isLeft: <L, R>(either: Either<L, R>) => either is Either<L, R> & {
|
|
137
|
+
value: L;
|
|
138
|
+
};
|
|
139
|
+
declare const tryCatch: <L, R>(f: () => R, onError: (error: unknown) => L) => Either<L, R>;
|
|
140
|
+
|
|
141
|
+
type SafeTraversable<K, V> = Omit<Traversable<Tuple<[K, V]>>, "map" | "flatMap">;
|
|
142
|
+
type Map<K, V> = {
|
|
143
|
+
add(item: Tuple<[K, V]>): Map<K, V>;
|
|
144
|
+
remove(value: K): Map<K, V>;
|
|
145
|
+
map<U>(f: (value: V) => U): Map<K, U>;
|
|
146
|
+
flatMap<K2, V2>(f: (entry: Tuple<[K, V]>) => _Iterable_<[K2, V2]>): Map<K2, V2>;
|
|
147
|
+
get(key: K): Option<V>;
|
|
148
|
+
getOrElse(key: K, defaultValue: V): V;
|
|
149
|
+
orElse(key: K, alternative: Option<V>): Option<V>;
|
|
150
|
+
} & SafeTraversable<K, V> & Collection<Tuple<[K, V]>>;
|
|
151
|
+
declare const Map: <K, V>(entries?: readonly (readonly [K, V])[] | IterableIterator<[K, V]> | null) => Map<K, V>;
|
|
152
|
+
|
|
153
|
+
type Try<T> = {
|
|
154
|
+
readonly _tag: "Success" | "Failure";
|
|
155
|
+
readonly value: T | undefined;
|
|
156
|
+
readonly error: Error | undefined;
|
|
157
|
+
isSuccess: () => boolean;
|
|
158
|
+
isFailure: () => boolean;
|
|
159
|
+
getOrElse: (defaultValue: T) => T;
|
|
160
|
+
orElse: (alternative: Try<T>) => Try<T>;
|
|
161
|
+
toEither: () => Either<Error, T>;
|
|
162
|
+
map: <U>(f: (value: T) => U) => Try<U>;
|
|
163
|
+
flatMap: <U>(f: (value: T) => Try<U>) => Try<U>;
|
|
164
|
+
valueOf: () => {
|
|
165
|
+
_tag: "Success" | "Failure";
|
|
166
|
+
value?: T;
|
|
167
|
+
error?: Error;
|
|
168
|
+
};
|
|
169
|
+
toString: () => string;
|
|
170
|
+
} & Typeable<"Success" | "Failure">;
|
|
171
|
+
declare const Try: <T>(f: () => T) => Try<T>;
|
|
172
|
+
|
|
173
|
+
type Traversable<A extends Type> = Functor<A> & {
|
|
174
|
+
get size(): number;
|
|
175
|
+
get isEmpty(): boolean;
|
|
176
|
+
contains(value: A): boolean;
|
|
177
|
+
reduce(f: (b: A, a: A) => A): A;
|
|
178
|
+
reduceRight(f: (b: A, a: A) => A): A;
|
|
179
|
+
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
180
|
+
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export { type Converters as C, type Either as E, List as L, Map as M, None as N, Option as O, Right as R, Some as S, Try as T, type _Iterable_ as _, Seq as a, Set as b, createSeq as c, type Collection as d, Left as e, isLeft as f, type Traversable as g, isRight as i, tryCatch as t };
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { Type, Functor } from './functor/index.js';
|
|
2
|
+
import { Tuple } from './tuple/Tuple.js';
|
|
3
|
+
import { Typeable } from './typeable/Typeable.js';
|
|
4
|
+
|
|
5
|
+
declare const Some: <T extends Type>(value: T) => Option<T>;
|
|
6
|
+
declare const None: <T extends Type>() => Option<T>;
|
|
7
|
+
type Option<T extends Type> = {
|
|
8
|
+
readonly _tag: "Some" | "None";
|
|
9
|
+
readonly value: T | undefined;
|
|
10
|
+
isEmpty: boolean;
|
|
11
|
+
get(): T;
|
|
12
|
+
getOrElse(defaultValue: T): T;
|
|
13
|
+
orElse(alternative: Option<T>): Option<T>;
|
|
14
|
+
map<U extends Type>(f: (value: T) => U): Option<U>;
|
|
15
|
+
flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
|
|
16
|
+
reduce<U>(f: (acc: U, value: T) => U): U;
|
|
17
|
+
reduceRight<U>(f: (acc: U, value: T) => U): U;
|
|
18
|
+
foldLeft<B>(z: B): (op: (b: B, a: T) => B) => B;
|
|
19
|
+
foldRight<B>(z: B): (op: (a: T, b: B) => B) => B;
|
|
20
|
+
toList(): _Iterable_<T>;
|
|
21
|
+
contains(value: T): boolean;
|
|
22
|
+
size: number;
|
|
23
|
+
valueOf(): {
|
|
24
|
+
_tag: "Some" | "None";
|
|
25
|
+
value?: T;
|
|
26
|
+
};
|
|
27
|
+
toString(): string;
|
|
28
|
+
} & Traversable<T> & Functor<T> & Typeable<"Some" | "None">;
|
|
29
|
+
declare const Option: <T extends Type>(value: T | null | undefined) => Option<T>;
|
|
30
|
+
|
|
31
|
+
declare const createSeq: <A>(values?: Iterable<A> | _Iterable_<A>) => Seq<A>;
|
|
32
|
+
type Seq<A> = {
|
|
33
|
+
readonly length: number;
|
|
34
|
+
readonly [Symbol.iterator]: () => Iterator<A>;
|
|
35
|
+
map: <B>(f: (a: A) => B) => Seq<B>;
|
|
36
|
+
flatMap: <B>(f: (a: A) => _Iterable_<B>) => Seq<B>;
|
|
37
|
+
forEach: (f: (a: A) => void) => void;
|
|
38
|
+
count: (p: (x: A) => boolean) => number;
|
|
39
|
+
exists: (p: (a: A) => boolean) => boolean;
|
|
40
|
+
filter: (p: (a: A) => boolean) => Seq<A>;
|
|
41
|
+
filterNot: (p: (a: A) => boolean) => Seq<A>;
|
|
42
|
+
find: (p: (a: A) => boolean) => Option<A>;
|
|
43
|
+
readonly head: A;
|
|
44
|
+
readonly headOption: Option<A>;
|
|
45
|
+
readonly isEmpty: boolean;
|
|
46
|
+
readonly size: number;
|
|
47
|
+
toArray: () => A[];
|
|
48
|
+
reduce: (f: (prev: A, curr: A) => A) => A;
|
|
49
|
+
reduceRight: (f: (prev: A, curr: A) => A) => A;
|
|
50
|
+
foldLeft: <B>(z: B) => (op: (b: B, a: A) => B) => B;
|
|
51
|
+
foldRight: <B>(z: B) => (op: (a: A, b: B) => B) => B;
|
|
52
|
+
valueOf: () => {
|
|
53
|
+
values: A[];
|
|
54
|
+
};
|
|
55
|
+
} & _Iterable_<A>;
|
|
56
|
+
declare const Seq: <A>(values?: Iterable<A> | _Iterable_<A>) => Seq<A>;
|
|
57
|
+
|
|
58
|
+
type _Iterable_<A extends Type> = {
|
|
59
|
+
count(p: (x: A) => boolean): number;
|
|
60
|
+
find(p: (a: A) => boolean): Option<A>;
|
|
61
|
+
forEach(f: (a: A) => void): void;
|
|
62
|
+
exists(p: (a: A) => boolean): boolean;
|
|
63
|
+
filter(p: (a: A) => boolean): _Iterable_<A>;
|
|
64
|
+
filterNot(p: (a: A) => boolean): _Iterable_<A>;
|
|
65
|
+
reduce(f: (b: A, a: A) => A): A;
|
|
66
|
+
reduceRight(f: (b: A, a: A) => A): A;
|
|
67
|
+
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
68
|
+
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
69
|
+
get head(): A;
|
|
70
|
+
get headOption(): Option<A>;
|
|
71
|
+
get isEmpty(): boolean;
|
|
72
|
+
map<B extends Type>(f: (a: A) => B): _Iterable_<B>;
|
|
73
|
+
flatMap<B extends Type>(f: (a: A) => _Iterable_<B> | Iterable<B>): _Iterable_<B>;
|
|
74
|
+
get size(): number;
|
|
75
|
+
toArray(): readonly A[];
|
|
76
|
+
} & Functor<A>;
|
|
77
|
+
|
|
78
|
+
type Set<A> = {
|
|
79
|
+
add: (value: A) => Set<A>;
|
|
80
|
+
remove: (value: A) => Set<A>;
|
|
81
|
+
contains: (value: A) => boolean;
|
|
82
|
+
has: (value: A) => boolean;
|
|
83
|
+
map: <B>(f: (a: A) => B) => Set<B>;
|
|
84
|
+
flatMap: <B>(f: (a: A) => _Iterable_<B>) => Set<B>;
|
|
85
|
+
toList: () => List<A>;
|
|
86
|
+
toSet: () => Set<A>;
|
|
87
|
+
toString: () => string;
|
|
88
|
+
} & _Iterable_<A> & Collection<A>;
|
|
89
|
+
declare const Set: <A>(iterable?: Iterable<A> | _Iterable_<A>) => Set<A>;
|
|
90
|
+
|
|
91
|
+
type Converters<A> = {
|
|
92
|
+
toList(): List<A>;
|
|
93
|
+
toSet(): Set<A>;
|
|
94
|
+
toString(): string;
|
|
95
|
+
};
|
|
96
|
+
type Collection<A> = Converters<A>;
|
|
97
|
+
|
|
98
|
+
type List<A> = {
|
|
99
|
+
add: (item: A) => List<A>;
|
|
100
|
+
map: <B>(f: (a: A) => B) => List<B>;
|
|
101
|
+
flatMap: <B>(f: (a: A) => _Iterable_<B>) => List<B>;
|
|
102
|
+
remove: (value: A) => List<A>;
|
|
103
|
+
contains: (value: A) => boolean;
|
|
104
|
+
removeAt: (index: number) => List<A>;
|
|
105
|
+
get: (index: number) => Option<A>;
|
|
106
|
+
concat: (other: List<A>) => List<A>;
|
|
107
|
+
toList: () => List<A>;
|
|
108
|
+
toSet: () => Set<A>;
|
|
109
|
+
toString: () => string;
|
|
110
|
+
valueOf: () => {
|
|
111
|
+
values: A[];
|
|
112
|
+
};
|
|
113
|
+
} & ArrayLike<A> & _Iterable_<A> & Collection<A>;
|
|
114
|
+
declare const List: <A>(values?: Iterable<A> | _Iterable_<A>) => List<A>;
|
|
115
|
+
|
|
116
|
+
type Either<L extends Type, R extends Type> = {
|
|
117
|
+
readonly _tag: "Left" | "Right";
|
|
118
|
+
value: L | R;
|
|
119
|
+
isLeft: () => boolean;
|
|
120
|
+
isRight: () => boolean;
|
|
121
|
+
map: <U extends Type>(f: (value: R) => U) => Either<L, U>;
|
|
122
|
+
flatMap: <U extends Type>(f: (value: R) => Either<L, U>) => Either<L, U>;
|
|
123
|
+
toOption: () => Option<R>;
|
|
124
|
+
toList: () => List<R>;
|
|
125
|
+
valueOf: () => {
|
|
126
|
+
_tag: "Left" | "Right";
|
|
127
|
+
value: L | R;
|
|
128
|
+
};
|
|
129
|
+
toString: () => string;
|
|
130
|
+
} & Functor<R> & Typeable<"Left" | "Right">;
|
|
131
|
+
declare const Right: <L, R>(value: R) => Either<L, R>;
|
|
132
|
+
declare const Left: <L, R>(value: L) => Either<L, R>;
|
|
133
|
+
declare const isRight: <L, R>(either: Either<L, R>) => either is Either<L, R> & {
|
|
134
|
+
value: R;
|
|
135
|
+
};
|
|
136
|
+
declare const isLeft: <L, R>(either: Either<L, R>) => either is Either<L, R> & {
|
|
137
|
+
value: L;
|
|
138
|
+
};
|
|
139
|
+
declare const tryCatch: <L, R>(f: () => R, onError: (error: unknown) => L) => Either<L, R>;
|
|
140
|
+
|
|
141
|
+
type SafeTraversable<K, V> = Omit<Traversable<Tuple<[K, V]>>, "map" | "flatMap">;
|
|
142
|
+
type Map<K, V> = {
|
|
143
|
+
add(item: Tuple<[K, V]>): Map<K, V>;
|
|
144
|
+
remove(value: K): Map<K, V>;
|
|
145
|
+
map<U>(f: (value: V) => U): Map<K, U>;
|
|
146
|
+
flatMap<K2, V2>(f: (entry: Tuple<[K, V]>) => _Iterable_<[K2, V2]>): Map<K2, V2>;
|
|
147
|
+
get(key: K): Option<V>;
|
|
148
|
+
getOrElse(key: K, defaultValue: V): V;
|
|
149
|
+
orElse(key: K, alternative: Option<V>): Option<V>;
|
|
150
|
+
} & SafeTraversable<K, V> & Collection<Tuple<[K, V]>>;
|
|
151
|
+
declare const Map: <K, V>(entries?: readonly (readonly [K, V])[] | IterableIterator<[K, V]> | null) => Map<K, V>;
|
|
152
|
+
|
|
153
|
+
type Try<T> = {
|
|
154
|
+
readonly _tag: "Success" | "Failure";
|
|
155
|
+
readonly value: T | undefined;
|
|
156
|
+
readonly error: Error | undefined;
|
|
157
|
+
isSuccess: () => boolean;
|
|
158
|
+
isFailure: () => boolean;
|
|
159
|
+
getOrElse: (defaultValue: T) => T;
|
|
160
|
+
orElse: (alternative: Try<T>) => Try<T>;
|
|
161
|
+
toEither: () => Either<Error, T>;
|
|
162
|
+
map: <U>(f: (value: T) => U) => Try<U>;
|
|
163
|
+
flatMap: <U>(f: (value: T) => Try<U>) => Try<U>;
|
|
164
|
+
valueOf: () => {
|
|
165
|
+
_tag: "Success" | "Failure";
|
|
166
|
+
value?: T;
|
|
167
|
+
error?: Error;
|
|
168
|
+
};
|
|
169
|
+
toString: () => string;
|
|
170
|
+
} & Typeable<"Success" | "Failure">;
|
|
171
|
+
declare const Try: <T>(f: () => T) => Try<T>;
|
|
172
|
+
|
|
173
|
+
type Traversable<A extends Type> = Functor<A> & {
|
|
174
|
+
get size(): number;
|
|
175
|
+
get isEmpty(): boolean;
|
|
176
|
+
contains(value: A): boolean;
|
|
177
|
+
reduce(f: (b: A, a: A) => A): A;
|
|
178
|
+
reduceRight(f: (b: A, a: A) => A): A;
|
|
179
|
+
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
180
|
+
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export { type Converters as C, type Either as E, List as L, Map as M, None as N, Option as O, Right as R, Some as S, Try as T, type _Iterable_ as _, Seq as a, Set as b, createSeq as c, type Collection as d, Left as e, isLeft as f, type Traversable as g, isRight as i, tryCatch as t };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { E as Either,
|
|
3
|
-
export {
|
|
4
|
-
|
|
1
|
+
export { AbstractFunctor, ArrayFunctor, ArrayType, Functor, SingleType, Type } from './functor/index.mjs';
|
|
2
|
+
export { E as Either, e as Left, L as List, M as Map, N as None, O as Option, R as Right, a as Seq, b as Set, S as Some, g as Traversable, T as Try, _ as _Iterable_, f as isLeft, i as isRight, t as tryCatch } from './index-5xp8zYMn.mjs';
|
|
3
|
+
export { Tuple } from './tuple/Tuple.mjs';
|
|
4
|
+
import './typeable/Typeable.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { E as Either,
|
|
3
|
-
export {
|
|
4
|
-
|
|
1
|
+
export { AbstractFunctor, ArrayFunctor, ArrayType, Functor, SingleType, Type } from './functor/index.js';
|
|
2
|
+
export { E as Either, e as Left, L as List, M as Map, N as None, O as Option, R as Right, a as Seq, b as Set, S as Some, g as Traversable, T as Try, _ as _Iterable_, f as isLeft, i as isRight, t as tryCatch } from './index-8YakfACG.js';
|
|
3
|
+
export { Tuple } from './tuple/Tuple.js';
|
|
4
|
+
import './typeable/Typeable.js';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQ65ZRGZHjs = require('./chunk-Q65ZRGZH.js');var _chunkBSQMHA7Ajs = require('./chunk-BSQMHA7A.js');require('./chunk-XORABVON.js');var _chunk6GSI27WUjs = require('./chunk-6GSI27WU.js');require('./chunk-5VTXJIR3.js');var _chunkOXLZ6UIZjs = require('./chunk-OXLZ6UIZ.js');var _chunkN3GTVYCOjs = require('./chunk-N3GTVYCO.js');require('./chunk-3VJERXBP.js');var _chunkAB3QRD66js = require('./chunk-AB3QRD66.js');require('./chunk-BNNK42JC.js');exports.Left = _chunkBSQMHA7Ajs.b; exports.List = _chunkN3GTVYCOjs.b; exports.Map = _chunk6GSI27WUjs.a; exports.None = _chunkAB3QRD66js.b; exports.Option = _chunkAB3QRD66js.c; exports.Right = _chunkBSQMHA7Ajs.a; exports.Seq = _chunkAB3QRD66js.e; exports.Set = _chunkN3GTVYCOjs.a; exports.Some = _chunkAB3QRD66js.a; exports.Try = _chunkQ65ZRGZHjs.a; exports.Tuple = _chunkOXLZ6UIZjs.a; exports.isLeft = _chunkBSQMHA7Ajs.d; exports.isRight = _chunkBSQMHA7Ajs.c; exports.tryCatch = _chunkBSQMHA7Ajs.e;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{a as i}from"./chunk-JQ7HMWOT.mjs";import{a as m,b as A,c as x,d as a,e as B}from"./chunk-PJIXAQSQ.mjs";import"./chunk-V2J3R5IU.mjs";import{a as n}from"./chunk-OWW7KOUW.mjs";import"./chunk-377WQNCB.mjs";import{a as b}from"./chunk-2I2NKDFN.mjs";import{a as p,b as f}from"./chunk-I7TGEFK5.mjs";import"./chunk-HA5XD5KC.mjs";import{a as o,b as e,c as r,e as t}from"./chunk-O7DO2OKU.mjs";import"./chunk-RRAIFS3D.mjs";export{A as Left,f as List,n as Map,e as None,r as Option,m as Right,t as Seq,p as Set,o as Some,i as Try,b as Tuple,a as isLeft,x as isRight,B as tryCatch};
|