functype 0.8.35 → 0.8.36
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 +43 -43
- package/dist/chunk-4H62YQ42.mjs +0 -0
- package/dist/chunk-5NZRFQ7O.mjs +1 -0
- package/dist/chunk-OTZ4XGNK.js +1 -0
- package/dist/chunk-WTWWDZY6.js +1 -0
- package/dist/collections/index.d.mts +1 -1
- package/dist/collections/index.d.ts +1 -1
- package/dist/core/task/Task.d.mts +1 -1
- package/dist/core/task/Task.d.ts +1 -1
- package/dist/core/task/Task.js +1 -1
- package/dist/core/task/Task.mjs +1 -1
- package/dist/either/Either.d.mts +1 -1
- package/dist/either/Either.d.ts +1 -1
- package/dist/either/Either.js +1 -1
- package/dist/either/Either.mjs +1 -1
- package/dist/{index-B6k3GVAd.d.ts → index-Bvqg1Srg.d.ts} +47 -55
- package/dist/{index-Cwkc_dEO.d.mts → index-D6OHxaFT.d.mts} +47 -55
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/iterable/index.d.mts +1 -1
- package/dist/iterable/index.d.ts +1 -1
- package/dist/iterable/index.js +1 -1
- package/dist/iterable/index.mjs +1 -1
- package/dist/list/List.d.mts +1 -1
- package/dist/list/List.d.ts +1 -1
- package/dist/list/List.js +1 -1
- package/dist/list/List.mjs +1 -1
- package/dist/map/Map.d.mts +1 -1
- package/dist/map/Map.d.ts +1 -1
- package/dist/map/Map.js +1 -1
- package/dist/map/Map.mjs +1 -1
- package/dist/option/Option.d.mts +1 -1
- package/dist/option/Option.d.ts +1 -1
- package/dist/option/Option.js +1 -1
- package/dist/option/Option.mjs +1 -1
- package/dist/set/Set.d.mts +1 -1
- package/dist/set/Set.d.ts +1 -1
- package/dist/set/Set.js +1 -1
- package/dist/set/Set.mjs +1 -1
- package/dist/try/Try.d.mts +1 -1
- package/dist/try/Try.d.ts +1 -1
- package/dist/try/Try.js +1 -1
- package/dist/try/Try.mjs +1 -1
- package/dist/typeable/Typeable.d.mts +5 -4
- package/dist/typeable/Typeable.d.ts +5 -4
- package/dist/util/index.d.mts +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.js +1 -1
- package/dist/util/index.mjs +1 -1
- package/dist/util/isIterable.js +1 -1
- package/dist/util/isIterable.mjs +1 -1
- package/package.json +10 -10
- package/dist/chunk-52OPFRS2.js +0 -1
- package/dist/chunk-BNNK42JC.js +0 -1
- package/dist/chunk-QBAH7SOA.mjs +0 -1
- package/dist/chunk-RRAIFS3D.mjs +0 -1
- package/dist/iterable/Seq.d.mts +0 -8
- package/dist/iterable/Seq.d.ts +0 -8
- package/dist/iterable/Seq.js +0 -1
- package/dist/iterable/Seq.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/README.md
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
# functype
|
|
2
|
-
|
|
3
|
-
A small functional library for TypeScript inspired by FP, Scala Standard Library, and ZIO
|
|
4
|
-
|
|
5
|
-

|
|
6
|
-
|
|
7
|
-
[](https://github.com/jordanburke/functype/actions/workflows/pnpm-build.yml)
|
|
8
|
-
|
|
9
|
-
# Functype - A Functional Library for TypeScript
|
|
10
|
-
|
|
11
|
-
Functype is a functional programming library for TypeScript, inspired by FP, Scala's standard library and ZIO. It offers a collection of utilities and abstractions to facilitate functional programming paradigms within TypeScript applications. The library is designed to provide developers with tools that promote immutability, pure functions, and composability, aligning with functional programming principles.
|
|
12
|
-
|
|
13
|
-
## Key Features
|
|
14
|
-
|
|
15
|
-
- **Functional Utilities:** Functype includes a variety of functions and combinators that assist in writing functional code, such as `map`, `filter`, and `reduce` operations tailored for TypeScript.
|
|
16
|
-
|
|
17
|
-
- **Type Safety:** Leveraging TypeScript's type system, Functype ensures that functional operations are type-safe, reducing runtime errors and enhancing code reliability.
|
|
18
|
-
|
|
19
|
-
- **Immutability Support:** The library emphasizes immutable data structures, encouraging developers to write predictable and side-effect-free code.
|
|
20
|
-
|
|
21
|
-
- **Type Orientation:** Functype encourages TypeScript developers to adopt functional programming principles through type annotations and type inference.
|
|
22
|
-
|
|
23
|
-
- **Composability:** Functype provides a collection of abstractions and utilities for composing complex functional programs.
|
|
24
|
-
|
|
25
|
-
## Installation
|
|
26
|
-
|
|
27
|
-
You can install `functype` using any package manager:
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
npm install functype
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
pnpm install functype
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
yarn install functype
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
bun install functype
|
|
43
|
-
```
|
|
1
|
+
# functype
|
|
2
|
+
|
|
3
|
+
A small functional library for TypeScript inspired by FP, Scala Standard Library, and ZIO
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
[](https://github.com/jordanburke/functype/actions/workflows/pnpm-build.yml)
|
|
8
|
+
|
|
9
|
+
# Functype - A Functional Library for TypeScript
|
|
10
|
+
|
|
11
|
+
Functype is a functional programming library for TypeScript, inspired by FP, Scala's standard library and ZIO. It offers a collection of utilities and abstractions to facilitate functional programming paradigms within TypeScript applications. The library is designed to provide developers with tools that promote immutability, pure functions, and composability, aligning with functional programming principles.
|
|
12
|
+
|
|
13
|
+
## Key Features
|
|
14
|
+
|
|
15
|
+
- **Functional Utilities:** Functype includes a variety of functions and combinators that assist in writing functional code, such as `map`, `filter`, and `reduce` operations tailored for TypeScript.
|
|
16
|
+
|
|
17
|
+
- **Type Safety:** Leveraging TypeScript's type system, Functype ensures that functional operations are type-safe, reducing runtime errors and enhancing code reliability.
|
|
18
|
+
|
|
19
|
+
- **Immutability Support:** The library emphasizes immutable data structures, encouraging developers to write predictable and side-effect-free code.
|
|
20
|
+
|
|
21
|
+
- **Type Orientation:** Functype encourages TypeScript developers to adopt functional programming principles through type annotations and type inference.
|
|
22
|
+
|
|
23
|
+
- **Composability:** Functype provides a collection of abstractions and utilities for composing complex functional programs.
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
You can install `functype` using any package manager:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install functype
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pnpm install functype
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
yarn install functype
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
bun install functype
|
|
43
|
+
```
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as g}from"./chunk-JF5YGNCO.mjs";import{a as v}from"./chunk-HD6YYUHO.mjs";import{a as R}from"./chunk-377WQNCB.mjs";import{a as U}from"./chunk-HA5XD5KC.mjs";import{a as B}from"./chunk-2I2NKDFN.mjs";import Q from"safe-stable-stringify";import S from"safe-stable-stringify";import j from"safe-stable-stringify";var c=e=>{let t=new U(e),r=l(t),o={...r,add:a=>c([...t,a]),remove:a=>{let L=new U(t);return L.delete(a),c(L)},contains:a=>t.has(a),has:a=>t.has(a),map:a=>c(r.map(a)),flatMap:a=>c(r.flatMap(a)),toList:()=>l(t),toSet:()=>o,toString:()=>`Set(${Array.from(t).toString()})`};return o},h=e=>c(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(a=>Array.from(o(a)))),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(a=>!o(a))),find:o=>u(t.find(o)),get head(){return t[0]},get headOption(){return t.length>0?u(t[0]):d()},get isEmpty(){return t.length===0},toArray:()=>[...t],reduce:o=>t.reduce(o),reduceRight:o=>t.reduceRight(o),foldLeft:o=>a=>t.reduce(a,o),foldRight:o=>a=>t.reduceRight((L,x)=>a(x,L),o),remove:o=>T(t.filter(a=>a!==o)),removeAt:o=>T(t.slice(0,o).concat(t.slice(o+1))),add:o=>T([...t,o]),get:o=>u(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(a=>!o(a)))),flatten:()=>T(t.flatMap(o=>Array.isArray(o)?o:[o])),toList:()=>r,toSet:()=>h(t),toString:()=>`List(${j(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(n(r))),merge:t=>t.isLeft()?n(t.value):i([e,t.value]),flatMap:t=>t(e),flatMapAsync:t=>t(e).catch(r=>n(r)),toOption:()=>y(e),toList:()=>l([e]),toString:()=>`Right(${S(e)})`,[Symbol.iterator]:function*(){yield e},yield:function*(){yield e},traverse:t=>{let r=t(e);return r.isLeft()?n(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:()=>n(e),then:(t,r)=>Promise.resolve(e).then(t,r)}),w=e=>({_tag:"Left",value:e,isLeft:()=>!0,isRight:()=>!1,getOrElse:t=>t,getOrThrow:()=>{throw e},map:t=>n(e),mapAsync:t=>Promise.resolve(n(e)),merge:t=>n(e),flatMap:t=>n(e),flatMapAsync:t=>Promise.resolve(n(e)),toOption:()=>d(),toList:()=>l(),toString:()=>`Left(${S(e)})`,[Symbol.iterator]:function*(){},yield:function*(){},traverse:t=>n(e),lazyMap:function*(t){yield n(e)},tap:t=>n(e),tapLeft:t=>(t(e),n(e)),mapLeft:t=>n(t(e)),bimap:(t,r)=>n(t(e)),fold:(t,r)=>t(e),swap:()=>i(e),then:(t,r)=>Promise.reject(e).then(null,r)}),i=e=>V(e),n=e=>w(e),Le=e=>e.isRight(),de=e=>e.isLeft(),ye=(e,t)=>{try{return i(e())}catch(r){return n(t(r))}},W=e=>V(e);console.assert(W);var D=e=>w(e);console.assert(D);var ce=async(e,t)=>{try{let r=await e();return i(r)}catch(r){return n(t(r))}},H={sequence:e=>{let t=[];for(let r of e){if(r.isLeft())return n(r.value);t.push(r.value)}return i(t)},traverse:(e,t)=>H.sequence(e.map(t)),fromNullable:(e,t)=>e==null?n(t):i(e),fromPredicate:(e,t,r)=>t(e)?i(e):n(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 n(t(r))}}};var E=(e,t)=>{let r=v(e,t);return{...g("AppException"),...n(r)}},A=e=>({...g("AppResult"),...i(e)});function O(e,t=r=>r){try{return A(e())}catch(r){return E(t(r))}}O.success=e=>A(e);O.fail=e=>E(e);async function K(e,t=r=>r){try{let r=await e();return A(r)}catch(r){let o=await t(r);return E(o)}}K.success=e=>A(e);K.fail=e=>E(e);var f=e=>{let t={values:new R(e)},r=()=>Array.from(t.values.entries()).map(([s,p])=>B([s,p])),o=s=>f(new R(t.values).set(s.toArray()[0],s.toArray()[1]).entries()),a=s=>{let p=new R(t.values);return p.delete(s)?f(p.entries()):f(t.values.entries())},L=s=>t.values.get(s[0])===s[1],x=()=>t.values.size,_=s=>f(Array.from(t.values.entries()).map(([p,G])=>[p,s(G)])),P=s=>{let p=f(t.values.entries()).toList();return f(p.flatMap(s).toArray())},I=s=>l(r()).reduce(s),N=s=>l(r()).reduceRight(s),z=s=>p=>l(r()).foldLeft(s)(p),F=s=>p=>l(r()).foldRight(s)(p),C=s=>u(t.values.get(s)),$=(s,p)=>u(t.values.get(s)).getOrElse(p),q=()=>t.values.size===0;return{add:o,remove:a,contains:L,get size(){return x()},map:_,flatMap:P,reduce:I,reduceRight:N,foldLeft:z,foldRight:F,get:C,getOrElse:$,get isEmpty(){return q()},orElse:(s,p)=>u(t.values.get(s)).orElse(p),toList:()=>l(r()),toSet:()=>h(r()),toString:()=>`Map(${r().toString()})`}},Ve=e=>f(e);import M from"safe-stable-stringify";var k=e=>({_tag:"Success",value:e,error:void 0,isSuccess:()=>!0,isFailure:()=>!1,get:()=>e,getOrElse:t=>e,orElse:t=>k(e),orThrow:t=>e,toEither:()=>i(e),map:t=>J(()=>t(e)),flatMap:t=>t(e),toString:()=>`Success(${M(e)})`}),b=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:()=>n(e),map:t=>b(e),flatMap:t=>b(e),toString:()=>`Failure(${M(e)}))`}),J=e=>{try{return k(e())}catch(t){return b(t instanceof Error?t:new Error(String(t)))}};var y=e=>({_tag:"Some",value:e,isEmpty:!1,get:()=>e,getOrElse:()=>e,getOrThrow:()=>e,orElse:()=>y(e),orNull:()=>e,map:t=>y(t(e)),filter(t){return t(e)?y(e):m},fold:(t,r)=>r(e),flatMap:t=>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(${Q(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,reduce:()=>{},reduceRight:()=>{},fold:(e,t)=>e(),foldLeft:e=>()=>e,foldRight:e=>()=>e,toList:()=>l([]),contains:()=>!1,size:0,toEither:e=>n(e),toString:()=>"None",toValue:()=>({_tag:"None",value:void 0})},d=()=>m,u=e=>e!=null?y(e):d();u.from=e=>u(e);u.none=()=>d();export{y as a,d as b,u as c,h as d,l as e,i as f,n as g,Le as h,de as i,ye as j,W as k,D as l,ce as m,H as n,E as o,A as p,O as q,K as r,Ve as s,J as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkSQWNJC6Ojs = require('./chunk-SQWNJC6O.js');var _chunk2U34DUZUjs = require('./chunk-2U34DUZU.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 c=e=>{let t=new (0, _chunk3VJERXBPjs.a)(e),r=l(t),o={...r,add:a=>c([...t,a]),remove:a=>{let L=new (0, _chunk3VJERXBPjs.a)(t);return L.delete(a),c(L)},contains:a=>t.has(a),has:a=>t.has(a),map:a=>c(r.map(a)),flatMap:a=>c(r.flatMap(a)),toList:()=>l(t),toSet:()=>o,toString:()=>`Set(${Array.from(t).toString()})`};return o},h= exports.d =e=>c(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(a=>Array.from(o(a)))),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(a=>!o(a))),find:o=>u(t.find(o)),get head(){return t[0]},get headOption(){return t.length>0?u(t[0]):d()},get isEmpty(){return t.length===0},toArray:()=>[...t],reduce:o=>t.reduce(o),reduceRight:o=>t.reduceRight(o),foldLeft:o=>a=>t.reduce(a,o),foldRight:o=>a=>t.reduceRight((L,x)=>a(x,L),o),remove:o=>T(t.filter(a=>a!==o)),removeAt:o=>T(t.slice(0,o).concat(t.slice(o+1))),add:o=>T([...t,o]),get:o=>u(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(a=>!o(a)))),flatten:()=>T(t.flatMap(o=>Array.isArray(o)?o:[o])),toList:()=>r,toSet:()=>h(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(n(r))),merge:t=>t.isLeft()?n(t.value):i([e,t.value]),flatMap:t=>t(e),flatMapAsync:t=>t(e).catch(r=>n(r)),toOption:()=>y(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()?n(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:()=>n(e),then:(t,r)=>Promise.resolve(e).then(t,r)}),w=e=>({_tag:"Left",value:e,isLeft:()=>!0,isRight:()=>!1,getOrElse:t=>t,getOrThrow:()=>{throw e},map:t=>n(e),mapAsync:t=>Promise.resolve(n(e)),merge:t=>n(e),flatMap:t=>n(e),flatMapAsync:t=>Promise.resolve(n(e)),toOption:()=>d(),toList:()=>l(),toString:()=>`Left(${_safestablestringify2.default.call(void 0, e)})`,[Symbol.iterator]:function*(){},yield:function*(){},traverse:t=>n(e),lazyMap:function*(t){yield n(e)},tap:t=>n(e),tapLeft:t=>(t(e),n(e)),mapLeft:t=>n(t(e)),bimap:(t,r)=>n(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),n= exports.g =e=>w(e),Le= exports.h =e=>e.isRight(),de= exports.i =e=>e.isLeft(),ye= exports.j =(e,t)=>{try{return i(e())}catch(r){return n(t(r))}},W= exports.k =e=>V(e);console.assert(W);var D=e=>w(e);console.assert(D);var ce=async(e,t)=>{try{let r=await e();return i(r)}catch(r){return n(t(r))}},H= exports.n ={sequence:e=>{let t=[];for(let r of e){if(r.isLeft())return n(r.value);t.push(r.value)}return i(t)},traverse:(e,t)=>H.sequence(e.map(t)),fromNullable:(e,t)=>e==null?n(t):i(e),fromPredicate:(e,t,r)=>t(e)?i(e):n(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 n(t(r))}}};var E=(e,t)=>{let r=_chunk2U34DUZUjs.a.call(void 0, e,t);return{..._chunkSQWNJC6Ojs.a.call(void 0, "AppException"),...n(r)}},A= exports.p =e=>({..._chunkSQWNJC6Ojs.a.call(void 0, "AppResult"),...i(e)});function O(e,t=r=>r){try{return A(e())}catch(r){return E(t(r))}}O.success=e=>A(e);O.fail=e=>E(e);async function K(e,t=r=>r){try{let r=await e();return A(r)}catch(r){let o=await t(r);return E(o)}}K.success=e=>A(e);K.fail=e=>E(e);var f=e=>{let t={values:new (0, _chunk5VTXJIR3js.a)(e)},r=()=>Array.from(t.values.entries()).map(([s,p])=>_chunkOXLZ6UIZjs.a.call(void 0, [s,p])),o=s=>f(new (0, _chunk5VTXJIR3js.a)(t.values).set(s.toArray()[0],s.toArray()[1]).entries()),a=s=>{let p=new (0, _chunk5VTXJIR3js.a)(t.values);return p.delete(s)?f(p.entries()):f(t.values.entries())},L=s=>t.values.get(s[0])===s[1],x=()=>t.values.size,_=s=>f(Array.from(t.values.entries()).map(([p,G])=>[p,s(G)])),P=s=>{let p=f(t.values.entries()).toList();return f(p.flatMap(s).toArray())},I=s=>l(r()).reduce(s),N=s=>l(r()).reduceRight(s),z=s=>p=>l(r()).foldLeft(s)(p),F=s=>p=>l(r()).foldRight(s)(p),C=s=>u(t.values.get(s)),$=(s,p)=>u(t.values.get(s)).getOrElse(p),q=()=>t.values.size===0;return{add:o,remove:a,contains:L,get size(){return x()},map:_,flatMap:P,reduce:I,reduceRight:N,foldLeft:z,foldRight:F,get:C,getOrElse:$,get isEmpty(){return q()},orElse:(s,p)=>u(t.values.get(s)).orElse(p),toList:()=>l(r()),toSet:()=>h(r()),toString:()=>`Map(${r().toString()})`}},Ve= exports.s =e=>f(e);var k=e=>({_tag:"Success",value:e,error:void 0,isSuccess:()=>!0,isFailure:()=>!1,get:()=>e,getOrElse:t=>e,orElse:t=>k(e),orThrow:t=>e,toEither:()=>i(e),map:t=>J(()=>t(e)),flatMap:t=>t(e),toString:()=>`Success(${_safestablestringify2.default.call(void 0, e)})`}),b=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:()=>n(e),map:t=>b(e),flatMap:t=>b(e),toString:()=>`Failure(${_safestablestringify2.default.call(void 0, e)}))`}),J= exports.t =e=>{try{return k(e())}catch(t){return b(t instanceof Error?t:new Error(String(t)))}};var y=e=>({_tag:"Some",value:e,isEmpty:!1,get:()=>e,getOrElse:()=>e,getOrThrow:()=>e,orElse:()=>y(e),orNull:()=>e,map:t=>y(t(e)),filter(t){return t(e)?y(e):m},fold:(t,r)=>r(e),flatMap:t=>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,reduce:()=>{},reduceRight:()=>{},fold:(e,t)=>e(),foldLeft:e=>()=>e,foldRight:e=>()=>e,toList:()=>l([]),contains:()=>!1,size:0,toEither:e=>n(e),toString:()=>"None",toValue:()=>({_tag:"None",value:void 0})},d= exports.b =()=>m,u= exports.c =e=>e!=null?y(e):d();u.from=e=>u(e);u.none=()=>d();exports.a = y; exports.b = d; exports.c = u; exports.d = h; exports.e = l; exports.f = i; exports.g = n; exports.h = Le; exports.i = de; exports.j = ye; exports.k = W; exports.l = D; exports.m = ce; exports.n = H; exports.o = E; exports.p = A; exports.q = O; exports.r = K; exports.s = Ve; exports.t = J;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AppException,
|
|
1
|
+
export { A as AppException, h as AppResult, k as AsyncTask, j as Task } from '../../index-D6OHxaFT.mjs';
|
|
2
2
|
import '../error/Throwable.mjs';
|
|
3
3
|
import '../../functor/index.mjs';
|
|
4
4
|
import '../base/Base.mjs';
|
package/dist/core/task/Task.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AppException,
|
|
1
|
+
export { A as AppException, h as AppResult, k as AsyncTask, j as Task } from '../../index-Bvqg1Srg.js';
|
|
2
2
|
import '../error/Throwable.js';
|
|
3
3
|
import '../../functor/index.js';
|
|
4
4
|
import '../base/Base.js';
|
package/dist/core/task/Task.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkOTZ4XGNKjs = require('../../chunk-OTZ4XGNK.js');require('../../chunk-SQWNJC6O.js');require('../../chunk-5O6YELD3.js');require('../../chunk-2U34DUZU.js');require('../../chunk-5VTXJIR3.js');require('../../chunk-3VJERXBP.js');require('../../chunk-OXLZ6UIZ.js');require('../../chunk-XORABVON.js');require('../../chunk-K3EKBPQE.js');require('../../chunk-WTWWDZY6.js');exports.AppException = _chunkOTZ4XGNKjs.o; exports.AppResult = _chunkOTZ4XGNKjs.p; exports.AsyncTask = _chunkOTZ4XGNKjs.r; exports.Task = _chunkOTZ4XGNKjs.q;
|
package/dist/core/task/Task.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{o as a,p as b,q as c,r as d}from"../../chunk-5NZRFQ7O.mjs";import"../../chunk-JF5YGNCO.mjs";import"../../chunk-V7DKESTM.mjs";import"../../chunk-HD6YYUHO.mjs";import"../../chunk-377WQNCB.mjs";import"../../chunk-HA5XD5KC.mjs";import"../../chunk-2I2NKDFN.mjs";import"../../chunk-V2J3R5IU.mjs";import"../../chunk-2ML63TYF.mjs";import"../../chunk-4H62YQ42.mjs";export{a as AppException,b as AppResult,d as AsyncTask,c as Task};
|
package/dist/either/Either.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../functor/index.mjs';
|
|
2
|
-
export { E as Either,
|
|
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-D6OHxaFT.mjs';
|
|
3
3
|
import '../typeable/Typeable.mjs';
|
|
4
4
|
import '../core/base/Base.mjs';
|
|
5
5
|
import '../core/error/Throwable.mjs';
|
package/dist/either/Either.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../functor/index.js';
|
|
2
|
-
export { E as Either,
|
|
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-Bvqg1Srg.js';
|
|
3
3
|
import '../typeable/Typeable.js';
|
|
4
4
|
import '../core/base/Base.js';
|
|
5
5
|
import '../core/error/Throwable.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 _chunkOTZ4XGNKjs = require('../chunk-OTZ4XGNK.js');require('../chunk-SQWNJC6O.js');require('../chunk-5O6YELD3.js');require('../chunk-2U34DUZU.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-XORABVON.js');require('../chunk-K3EKBPQE.js');require('../chunk-WTWWDZY6.js');exports.Either = _chunkOTZ4XGNKjs.n; exports.Left = _chunkOTZ4XGNKjs.g; exports.Right = _chunkOTZ4XGNKjs.f; exports.TypeCheckLeft = _chunkOTZ4XGNKjs.l; exports.TypeCheckRight = _chunkOTZ4XGNKjs.k; exports.isLeft = _chunkOTZ4XGNKjs.i; exports.isRight = _chunkOTZ4XGNKjs.h; exports.tryCatch = _chunkOTZ4XGNKjs.j; exports.tryCatchAsync = _chunkOTZ4XGNKjs.m;
|
package/dist/either/Either.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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-5NZRFQ7O.mjs";import"../chunk-JF5YGNCO.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-HD6YYUHO.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-V2J3R5IU.mjs";import"../chunk-2ML63TYF.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};
|
|
@@ -16,7 +16,7 @@ type Option<T extends Type> = {
|
|
|
16
16
|
getOrElse(defaultValue: T): T;
|
|
17
17
|
getOrThrow(error: Error): T;
|
|
18
18
|
orElse(alternative: Option<T>): Option<T>;
|
|
19
|
-
|
|
19
|
+
orNull(): T | null;
|
|
20
20
|
map<U extends Type>(f: (value: T) => U): Option<U>;
|
|
21
21
|
filter(predicate: (value: T) => boolean): Option<T>;
|
|
22
22
|
flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
|
|
@@ -41,42 +41,17 @@ declare const Option: {
|
|
|
41
41
|
none<T>(): Option<T>;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
type Seq<A> = {
|
|
46
|
-
readonly length: number;
|
|
47
|
-
readonly [Symbol.iterator]: () => Iterator<A>;
|
|
48
|
-
map: <B>(f: (a: A) => B) => Seq<B>;
|
|
49
|
-
flatMap: <B>(f: (a: A) => _Iterable_<B>) => Seq<B>;
|
|
50
|
-
forEach: (f: (a: A) => void) => void;
|
|
51
|
-
count: (p: (x: A) => boolean) => number;
|
|
52
|
-
exists: (p: (a: A) => boolean) => boolean;
|
|
53
|
-
filter: (p: (a: A) => boolean) => Seq<A>;
|
|
54
|
-
filterNot: (p: (a: A) => boolean) => Seq<A>;
|
|
55
|
-
find: (p: (a: A) => boolean) => Option<A>;
|
|
56
|
-
readonly head: A;
|
|
57
|
-
readonly headOption: Option<A>;
|
|
58
|
-
readonly isEmpty: boolean;
|
|
59
|
-
readonly size: number;
|
|
60
|
-
toArray: () => A[];
|
|
61
|
-
reduce: (f: (prev: A, curr: A) => A) => A;
|
|
62
|
-
reduceRight: (f: (prev: A, curr: A) => A) => A;
|
|
63
|
-
foldLeft: <B>(z: B) => (op: (b: B, a: A) => B) => B;
|
|
64
|
-
foldRight: <B>(z: B) => (op: (a: A, b: B) => B) => B;
|
|
65
|
-
toString: () => string;
|
|
66
|
-
toValue: () => {
|
|
67
|
-
_tag: string;
|
|
68
|
-
value: A[];
|
|
69
|
-
};
|
|
70
|
-
} & _Iterable_<A> & Typeable<"Seq">;
|
|
71
|
-
declare const Seq: <A>(values?: Iterable<A> | _Iterable_<A>) => Seq<A>;
|
|
72
|
-
|
|
73
|
-
type _Iterable_<A extends Type> = {
|
|
44
|
+
type IterableType<A extends Type> = {
|
|
74
45
|
count(p: (x: A) => boolean): number;
|
|
75
46
|
find(p: (a: A) => boolean): Option<A>;
|
|
76
47
|
forEach(f: (a: A) => void): void;
|
|
48
|
+
drop(n: number): IterableType<A>;
|
|
49
|
+
dropRight(n: number): IterableType<A>;
|
|
50
|
+
dropWhile(p: (a: A) => boolean): IterableType<A>;
|
|
77
51
|
exists(p: (a: A) => boolean): boolean;
|
|
78
|
-
filter(p: (a: A) => boolean):
|
|
79
|
-
filterNot(p: (a: A) => boolean):
|
|
52
|
+
filter(p: (a: A) => boolean): IterableType<A>;
|
|
53
|
+
filterNot(p: (a: A) => boolean): IterableType<A>;
|
|
54
|
+
flatten<B>(): IterableType<B>;
|
|
80
55
|
reduce(f: (b: A, a: A) => A): A;
|
|
81
56
|
reduceRight(f: (b: A, a: A) => A): A;
|
|
82
57
|
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
@@ -84,11 +59,22 @@ type _Iterable_<A extends Type> = {
|
|
|
84
59
|
get head(): A;
|
|
85
60
|
get headOption(): Option<A>;
|
|
86
61
|
get isEmpty(): boolean;
|
|
87
|
-
map<B extends Type>(f: (a: A) => B):
|
|
88
|
-
flatMap<B extends Type>(f: (a: A) =>
|
|
62
|
+
map<B extends Type>(f: (a: A) => B): IterableType<B>;
|
|
63
|
+
flatMap<B extends Type>(f: (a: A) => IterableType<B>): IterableType<B>;
|
|
89
64
|
get size(): number;
|
|
90
65
|
toArray(): readonly A[];
|
|
91
|
-
|
|
66
|
+
toValue: () => {
|
|
67
|
+
_tag: string;
|
|
68
|
+
value: A[];
|
|
69
|
+
};
|
|
70
|
+
} & Iterable<A> & Functor<A>;
|
|
71
|
+
|
|
72
|
+
type Converters<A> = {
|
|
73
|
+
toList(): List<A>;
|
|
74
|
+
toSet(): Set<A>;
|
|
75
|
+
toString(): string;
|
|
76
|
+
};
|
|
77
|
+
type Collection<A> = Converters<A>;
|
|
92
78
|
|
|
93
79
|
type Set<A> = {
|
|
94
80
|
add: (value: A) => Set<A>;
|
|
@@ -96,28 +82,35 @@ type Set<A> = {
|
|
|
96
82
|
contains: (value: A) => boolean;
|
|
97
83
|
has: (value: A) => boolean;
|
|
98
84
|
map: <B>(f: (a: A) => B) => Set<B>;
|
|
99
|
-
flatMap: <B>(f: (a: A) =>
|
|
85
|
+
flatMap: <B>(f: (a: A) => IterableType<B>) => Set<B>;
|
|
100
86
|
toList: () => List<A>;
|
|
101
87
|
toSet: () => Set<A>;
|
|
102
88
|
toString: () => string;
|
|
103
|
-
} &
|
|
104
|
-
declare const Set: <A>(iterable?: Iterable<A> |
|
|
105
|
-
|
|
106
|
-
type Converters<A> = {
|
|
107
|
-
toList(): List<A>;
|
|
108
|
-
toSet(): Set<A>;
|
|
109
|
-
toString(): string;
|
|
110
|
-
};
|
|
111
|
-
type Collection<A> = Converters<A>;
|
|
89
|
+
} & IterableType<A> & Collection<A>;
|
|
90
|
+
declare const Set: <A>(iterable?: Iterable<A> | IterableType<A>) => Set<A>;
|
|
112
91
|
|
|
113
|
-
type InternalList<A> = List<A> & ArrayLike<A> & _Iterable_<A> & Collection<A>;
|
|
114
92
|
type List<A> = {
|
|
115
|
-
|
|
93
|
+
readonly length: number;
|
|
94
|
+
readonly [Symbol.iterator]: () => Iterator<A>;
|
|
116
95
|
map: <B>(f: (a: A) => B) => List<B>;
|
|
117
|
-
flatMap: <B>(f: (a: A) =>
|
|
96
|
+
flatMap: <B>(f: (a: A) => IterableType<B>) => List<B>;
|
|
97
|
+
forEach: (f: (a: A) => void) => void;
|
|
98
|
+
count: (p: (x: A) => boolean) => number;
|
|
99
|
+
exists: (p: (a: A) => boolean) => boolean;
|
|
100
|
+
filter: (p: (a: A) => boolean) => List<A>;
|
|
101
|
+
filterNot: (p: (a: A) => boolean) => List<A>;
|
|
102
|
+
find: (p: (a: A) => boolean) => Option<A>;
|
|
103
|
+
readonly head: A;
|
|
104
|
+
readonly headOption: Option<A>;
|
|
105
|
+
readonly isEmpty: boolean;
|
|
106
|
+
toArray: () => A[];
|
|
107
|
+
reduce: (f: (prev: A, curr: A) => A) => A;
|
|
108
|
+
reduceRight: (f: (prev: A, curr: A) => A) => A;
|
|
109
|
+
foldLeft: <B>(z: B) => (op: (b: B, a: A) => B) => B;
|
|
110
|
+
foldRight: <B>(z: B) => (op: (a: A, b: B) => B) => B;
|
|
118
111
|
remove: (value: A) => List<A>;
|
|
119
|
-
contains: (value: A) => boolean;
|
|
120
112
|
removeAt: (index: number) => List<A>;
|
|
113
|
+
add: (item: A) => List<A>;
|
|
121
114
|
get: (index: number) => Option<A>;
|
|
122
115
|
concat: (other: List<A>) => List<A>;
|
|
123
116
|
toList: () => List<A>;
|
|
@@ -127,9 +120,8 @@ type List<A> = {
|
|
|
127
120
|
_tag: string;
|
|
128
121
|
value: A[];
|
|
129
122
|
};
|
|
130
|
-
} &
|
|
131
|
-
declare const List: <A>(values?: Iterable<A>
|
|
132
|
-
declare const TestList: <A>(values?: Iterable<A> | _Iterable_<A>) => InternalList<A>;
|
|
123
|
+
} & IterableType<A> & Typeable<"List">;
|
|
124
|
+
declare const List: <A>(values?: Iterable<A>) => List<A>;
|
|
133
125
|
|
|
134
126
|
type TestEither<L extends Type, R extends Type> = Either<L, R> & Functor<R>;
|
|
135
127
|
declare const Right: <L extends Type, R extends Type>(value: R) => Either<L, R>;
|
|
@@ -207,7 +199,7 @@ type Map<K, V> = {
|
|
|
207
199
|
add(item: Tuple<[K, V]>): Map<K, V>;
|
|
208
200
|
remove(value: K): Map<K, V>;
|
|
209
201
|
map<U>(f: (value: V) => U): Map<K, U>;
|
|
210
|
-
flatMap<K2, V2>(f: (entry: Tuple<[K, V]>) =>
|
|
202
|
+
flatMap<K2, V2>(f: (entry: Tuple<[K, V]>) => IterableType<[K2, V2]>): Map<K2, V2>;
|
|
211
203
|
get(key: K): Option<V>;
|
|
212
204
|
getOrElse(key: K, defaultValue: V): V;
|
|
213
205
|
orElse(key: K, alternative: Option<V>): Option<V>;
|
|
@@ -241,4 +233,4 @@ type Traversable<A extends Type> = Functor<A> & {
|
|
|
241
233
|
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
242
234
|
};
|
|
243
235
|
|
|
244
|
-
export { AppException as A, type Converters as C, Either as E, List as L, Map as M, None as N, Option as O, Right as R, Some as S,
|
|
236
|
+
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 };
|
|
@@ -16,7 +16,7 @@ type Option<T extends Type> = {
|
|
|
16
16
|
getOrElse(defaultValue: T): T;
|
|
17
17
|
getOrThrow(error: Error): T;
|
|
18
18
|
orElse(alternative: Option<T>): Option<T>;
|
|
19
|
-
|
|
19
|
+
orNull(): T | null;
|
|
20
20
|
map<U extends Type>(f: (value: T) => U): Option<U>;
|
|
21
21
|
filter(predicate: (value: T) => boolean): Option<T>;
|
|
22
22
|
flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
|
|
@@ -41,42 +41,17 @@ declare const Option: {
|
|
|
41
41
|
none<T>(): Option<T>;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
type Seq<A> = {
|
|
46
|
-
readonly length: number;
|
|
47
|
-
readonly [Symbol.iterator]: () => Iterator<A>;
|
|
48
|
-
map: <B>(f: (a: A) => B) => Seq<B>;
|
|
49
|
-
flatMap: <B>(f: (a: A) => _Iterable_<B>) => Seq<B>;
|
|
50
|
-
forEach: (f: (a: A) => void) => void;
|
|
51
|
-
count: (p: (x: A) => boolean) => number;
|
|
52
|
-
exists: (p: (a: A) => boolean) => boolean;
|
|
53
|
-
filter: (p: (a: A) => boolean) => Seq<A>;
|
|
54
|
-
filterNot: (p: (a: A) => boolean) => Seq<A>;
|
|
55
|
-
find: (p: (a: A) => boolean) => Option<A>;
|
|
56
|
-
readonly head: A;
|
|
57
|
-
readonly headOption: Option<A>;
|
|
58
|
-
readonly isEmpty: boolean;
|
|
59
|
-
readonly size: number;
|
|
60
|
-
toArray: () => A[];
|
|
61
|
-
reduce: (f: (prev: A, curr: A) => A) => A;
|
|
62
|
-
reduceRight: (f: (prev: A, curr: A) => A) => A;
|
|
63
|
-
foldLeft: <B>(z: B) => (op: (b: B, a: A) => B) => B;
|
|
64
|
-
foldRight: <B>(z: B) => (op: (a: A, b: B) => B) => B;
|
|
65
|
-
toString: () => string;
|
|
66
|
-
toValue: () => {
|
|
67
|
-
_tag: string;
|
|
68
|
-
value: A[];
|
|
69
|
-
};
|
|
70
|
-
} & _Iterable_<A> & Typeable<"Seq">;
|
|
71
|
-
declare const Seq: <A>(values?: Iterable<A> | _Iterable_<A>) => Seq<A>;
|
|
72
|
-
|
|
73
|
-
type _Iterable_<A extends Type> = {
|
|
44
|
+
type IterableType<A extends Type> = {
|
|
74
45
|
count(p: (x: A) => boolean): number;
|
|
75
46
|
find(p: (a: A) => boolean): Option<A>;
|
|
76
47
|
forEach(f: (a: A) => void): void;
|
|
48
|
+
drop(n: number): IterableType<A>;
|
|
49
|
+
dropRight(n: number): IterableType<A>;
|
|
50
|
+
dropWhile(p: (a: A) => boolean): IterableType<A>;
|
|
77
51
|
exists(p: (a: A) => boolean): boolean;
|
|
78
|
-
filter(p: (a: A) => boolean):
|
|
79
|
-
filterNot(p: (a: A) => boolean):
|
|
52
|
+
filter(p: (a: A) => boolean): IterableType<A>;
|
|
53
|
+
filterNot(p: (a: A) => boolean): IterableType<A>;
|
|
54
|
+
flatten<B>(): IterableType<B>;
|
|
80
55
|
reduce(f: (b: A, a: A) => A): A;
|
|
81
56
|
reduceRight(f: (b: A, a: A) => A): A;
|
|
82
57
|
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
@@ -84,11 +59,22 @@ type _Iterable_<A extends Type> = {
|
|
|
84
59
|
get head(): A;
|
|
85
60
|
get headOption(): Option<A>;
|
|
86
61
|
get isEmpty(): boolean;
|
|
87
|
-
map<B extends Type>(f: (a: A) => B):
|
|
88
|
-
flatMap<B extends Type>(f: (a: A) =>
|
|
62
|
+
map<B extends Type>(f: (a: A) => B): IterableType<B>;
|
|
63
|
+
flatMap<B extends Type>(f: (a: A) => IterableType<B>): IterableType<B>;
|
|
89
64
|
get size(): number;
|
|
90
65
|
toArray(): readonly A[];
|
|
91
|
-
|
|
66
|
+
toValue: () => {
|
|
67
|
+
_tag: string;
|
|
68
|
+
value: A[];
|
|
69
|
+
};
|
|
70
|
+
} & Iterable<A> & Functor<A>;
|
|
71
|
+
|
|
72
|
+
type Converters<A> = {
|
|
73
|
+
toList(): List<A>;
|
|
74
|
+
toSet(): Set<A>;
|
|
75
|
+
toString(): string;
|
|
76
|
+
};
|
|
77
|
+
type Collection<A> = Converters<A>;
|
|
92
78
|
|
|
93
79
|
type Set<A> = {
|
|
94
80
|
add: (value: A) => Set<A>;
|
|
@@ -96,28 +82,35 @@ type Set<A> = {
|
|
|
96
82
|
contains: (value: A) => boolean;
|
|
97
83
|
has: (value: A) => boolean;
|
|
98
84
|
map: <B>(f: (a: A) => B) => Set<B>;
|
|
99
|
-
flatMap: <B>(f: (a: A) =>
|
|
85
|
+
flatMap: <B>(f: (a: A) => IterableType<B>) => Set<B>;
|
|
100
86
|
toList: () => List<A>;
|
|
101
87
|
toSet: () => Set<A>;
|
|
102
88
|
toString: () => string;
|
|
103
|
-
} &
|
|
104
|
-
declare const Set: <A>(iterable?: Iterable<A> |
|
|
105
|
-
|
|
106
|
-
type Converters<A> = {
|
|
107
|
-
toList(): List<A>;
|
|
108
|
-
toSet(): Set<A>;
|
|
109
|
-
toString(): string;
|
|
110
|
-
};
|
|
111
|
-
type Collection<A> = Converters<A>;
|
|
89
|
+
} & IterableType<A> & Collection<A>;
|
|
90
|
+
declare const Set: <A>(iterable?: Iterable<A> | IterableType<A>) => Set<A>;
|
|
112
91
|
|
|
113
|
-
type InternalList<A> = List<A> & ArrayLike<A> & _Iterable_<A> & Collection<A>;
|
|
114
92
|
type List<A> = {
|
|
115
|
-
|
|
93
|
+
readonly length: number;
|
|
94
|
+
readonly [Symbol.iterator]: () => Iterator<A>;
|
|
116
95
|
map: <B>(f: (a: A) => B) => List<B>;
|
|
117
|
-
flatMap: <B>(f: (a: A) =>
|
|
96
|
+
flatMap: <B>(f: (a: A) => IterableType<B>) => List<B>;
|
|
97
|
+
forEach: (f: (a: A) => void) => void;
|
|
98
|
+
count: (p: (x: A) => boolean) => number;
|
|
99
|
+
exists: (p: (a: A) => boolean) => boolean;
|
|
100
|
+
filter: (p: (a: A) => boolean) => List<A>;
|
|
101
|
+
filterNot: (p: (a: A) => boolean) => List<A>;
|
|
102
|
+
find: (p: (a: A) => boolean) => Option<A>;
|
|
103
|
+
readonly head: A;
|
|
104
|
+
readonly headOption: Option<A>;
|
|
105
|
+
readonly isEmpty: boolean;
|
|
106
|
+
toArray: () => A[];
|
|
107
|
+
reduce: (f: (prev: A, curr: A) => A) => A;
|
|
108
|
+
reduceRight: (f: (prev: A, curr: A) => A) => A;
|
|
109
|
+
foldLeft: <B>(z: B) => (op: (b: B, a: A) => B) => B;
|
|
110
|
+
foldRight: <B>(z: B) => (op: (a: A, b: B) => B) => B;
|
|
118
111
|
remove: (value: A) => List<A>;
|
|
119
|
-
contains: (value: A) => boolean;
|
|
120
112
|
removeAt: (index: number) => List<A>;
|
|
113
|
+
add: (item: A) => List<A>;
|
|
121
114
|
get: (index: number) => Option<A>;
|
|
122
115
|
concat: (other: List<A>) => List<A>;
|
|
123
116
|
toList: () => List<A>;
|
|
@@ -127,9 +120,8 @@ type List<A> = {
|
|
|
127
120
|
_tag: string;
|
|
128
121
|
value: A[];
|
|
129
122
|
};
|
|
130
|
-
} &
|
|
131
|
-
declare const List: <A>(values?: Iterable<A>
|
|
132
|
-
declare const TestList: <A>(values?: Iterable<A> | _Iterable_<A>) => InternalList<A>;
|
|
123
|
+
} & IterableType<A> & Typeable<"List">;
|
|
124
|
+
declare const List: <A>(values?: Iterable<A>) => List<A>;
|
|
133
125
|
|
|
134
126
|
type TestEither<L extends Type, R extends Type> = Either<L, R> & Functor<R>;
|
|
135
127
|
declare const Right: <L extends Type, R extends Type>(value: R) => Either<L, R>;
|
|
@@ -207,7 +199,7 @@ type Map<K, V> = {
|
|
|
207
199
|
add(item: Tuple<[K, V]>): Map<K, V>;
|
|
208
200
|
remove(value: K): Map<K, V>;
|
|
209
201
|
map<U>(f: (value: V) => U): Map<K, U>;
|
|
210
|
-
flatMap<K2, V2>(f: (entry: Tuple<[K, V]>) =>
|
|
202
|
+
flatMap<K2, V2>(f: (entry: Tuple<[K, V]>) => IterableType<[K2, V2]>): Map<K2, V2>;
|
|
211
203
|
get(key: K): Option<V>;
|
|
212
204
|
getOrElse(key: K, defaultValue: V): V;
|
|
213
205
|
orElse(key: K, alternative: Option<V>): Option<V>;
|
|
@@ -241,4 +233,4 @@ type Traversable<A extends Type> = Functor<A> & {
|
|
|
241
233
|
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
242
234
|
};
|
|
243
235
|
|
|
244
|
-
export { AppException as A, type Converters as C, Either as E, List as L, Map as M, None as N, Option as O, Right as R, Some as S,
|
|
236
|
+
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 };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { AbstractFunctor, ArrayFunctor, ArrayType, Functor, SingleType, Type } from './functor/index.mjs';
|
|
2
2
|
export { Base } from './core/base/Base.mjs';
|
|
3
3
|
export { Throwable } from './core/error/Throwable.mjs';
|
|
4
|
-
export { A as AppException,
|
|
4
|
+
export { A as AppException, h as AppResult, k as AsyncTask, E as Either, I as IterableType, c as Left, L as List, M as Map, N as None, O as Option, R as Right, b as Set, S as Some, j as Task, T as TestEither, m as Traversable, l as Try, f as TypeCheckLeft, e as TypeCheckRight, d as isLeft, i as isRight, t as tryCatch, g as tryCatchAsync } from './index-D6OHxaFT.mjs';
|
|
5
5
|
export { Identity } from './identity/Identity.mjs';
|
|
6
6
|
export { Tuple } from './tuple/Tuple.mjs';
|
|
7
|
-
export { Typeable } from './typeable/Typeable.mjs';
|
|
7
|
+
export { Typeable, UnTag } from './typeable/Typeable.mjs';
|
|
8
8
|
import './valuable/Valuable.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { AbstractFunctor, ArrayFunctor, ArrayType, Functor, SingleType, Type } from './functor/index.js';
|
|
2
2
|
export { Base } from './core/base/Base.js';
|
|
3
3
|
export { Throwable } from './core/error/Throwable.js';
|
|
4
|
-
export { A as AppException,
|
|
4
|
+
export { A as AppException, h as AppResult, k as AsyncTask, E as Either, I as IterableType, c as Left, L as List, M as Map, N as None, O as Option, R as Right, b as Set, S as Some, j as Task, T as TestEither, m as Traversable, l as Try, f as TypeCheckLeft, e as TypeCheckRight, d as isLeft, i as isRight, t as tryCatch, g as tryCatchAsync } from './index-Bvqg1Srg.js';
|
|
5
5
|
export { Identity } from './identity/Identity.js';
|
|
6
6
|
export { Tuple } from './tuple/Tuple.js';
|
|
7
|
-
export { Typeable } from './typeable/Typeable.js';
|
|
7
|
+
export { Typeable, UnTag } from './typeable/Typeable.js';
|
|
8
8
|
import './valuable/Valuable.js';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkOTZ4XGNKjs = require('./chunk-OTZ4XGNK.js');var _chunkSQWNJC6Ojs = require('./chunk-SQWNJC6O.js');var _chunk5O6YELD3js = require('./chunk-5O6YELD3.js');var _chunk2U34DUZUjs = require('./chunk-2U34DUZU.js');require('./chunk-5VTXJIR3.js');require('./chunk-3VJERXBP.js');var _chunkOXLZ6UIZjs = require('./chunk-OXLZ6UIZ.js');require('./chunk-XORABVON.js');require('./chunk-K3EKBPQE.js');require('./chunk-WTWWDZY6.js');exports.AppException = _chunkOTZ4XGNKjs.o; exports.AppResult = _chunkOTZ4XGNKjs.p; exports.AsyncTask = _chunkOTZ4XGNKjs.r; exports.Base = _chunkSQWNJC6Ojs.a; exports.Either = _chunkOTZ4XGNKjs.n; exports.Left = _chunkOTZ4XGNKjs.g; exports.List = _chunkOTZ4XGNKjs.e; exports.Map = _chunkOTZ4XGNKjs.s; exports.None = _chunkOTZ4XGNKjs.b; exports.Option = _chunkOTZ4XGNKjs.c; exports.Right = _chunkOTZ4XGNKjs.f; exports.Set = _chunkOTZ4XGNKjs.d; exports.Some = _chunkOTZ4XGNKjs.a; exports.Task = _chunkOTZ4XGNKjs.q; exports.Throwable = _chunk2U34DUZUjs.a; exports.Try = _chunkOTZ4XGNKjs.t; exports.Tuple = _chunkOXLZ6UIZjs.a; exports.TypeCheckLeft = _chunkOTZ4XGNKjs.l; exports.TypeCheckRight = _chunkOTZ4XGNKjs.k; exports.Typeable = _chunk5O6YELD3js.a; exports.isLeft = _chunkOTZ4XGNKjs.i; exports.isRight = _chunkOTZ4XGNKjs.h; exports.tryCatch = _chunkOTZ4XGNKjs.j; exports.tryCatchAsync = _chunkOTZ4XGNKjs.m;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,b as e,c as f,
|
|
1
|
+
import{a as d,b as e,c as f,d as g,e as h,f as i,g as j,h as k,i as l,j as m,k as n,l as o,m as p,n as q,o as r,p as s,q as t,r as u,s as w,t as x}from"./chunk-5NZRFQ7O.mjs";import{a as b}from"./chunk-JF5YGNCO.mjs";import{a}from"./chunk-V7DKESTM.mjs";import{a as c}from"./chunk-HD6YYUHO.mjs";import"./chunk-377WQNCB.mjs";import"./chunk-HA5XD5KC.mjs";import{a as v}from"./chunk-2I2NKDFN.mjs";import"./chunk-V2J3R5IU.mjs";import"./chunk-2ML63TYF.mjs";import"./chunk-4H62YQ42.mjs";export{r as AppException,s as AppResult,u as AsyncTask,b as Base,q as Either,j as Left,h as List,w as Map,e as None,f as Option,i as Right,g as Set,d as Some,t as Task,c as Throwable,x as Try,v as Tuple,o as TypeCheckLeft,n as TypeCheckRight,a as Typeable,l as isLeft,k as isRight,m as tryCatch,p as tryCatchAsync};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../functor/index.mjs';
|
|
2
|
-
export {
|
|
2
|
+
export { I as IterableType } from '../index-D6OHxaFT.mjs';
|
|
3
3
|
import '../core/base/Base.mjs';
|
|
4
4
|
import '../core/error/Throwable.mjs';
|
|
5
5
|
import '../typeable/Typeable.mjs';
|
package/dist/iterable/index.d.ts
CHANGED
package/dist/iterable/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";require('../chunk-WTWWDZY6.js');
|
package/dist/iterable/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import"../chunk-4H62YQ42.mjs";
|
package/dist/list/List.d.mts
CHANGED
package/dist/list/List.d.ts
CHANGED