functype 0.8.30 → 0.8.32
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 +21 -21
- package/dist/chunk-2U34DUZU.js +1 -0
- package/dist/chunk-ETU42J57.js +1 -0
- package/dist/chunk-HD6YYUHO.mjs +1 -0
- package/dist/chunk-JF5YGNCO.mjs +1 -0
- package/dist/chunk-JJLIOHWZ.mjs +1 -0
- package/dist/chunk-SQWNJC6O.js +1 -0
- package/dist/collections/index.d.mts +3 -1
- package/dist/collections/index.d.ts +3 -1
- package/dist/core/base/Base.d.mts +11 -0
- package/dist/core/base/Base.d.ts +11 -0
- package/dist/core/base/Base.js +1 -0
- package/dist/core/base/Base.mjs +1 -0
- package/dist/core/error/Throwable.d.mts +12 -0
- package/dist/core/error/Throwable.d.ts +12 -0
- package/dist/core/error/Throwable.js +1 -0
- package/dist/core/error/Throwable.mjs +1 -0
- package/dist/core/task/Task.d.mts +7 -0
- package/dist/core/task/Task.d.ts +7 -0
- package/dist/core/task/Task.js +1 -0
- package/dist/core/task/Task.mjs +1 -0
- package/dist/either/Either.d.mts +3 -1
- package/dist/either/Either.d.ts +3 -1
- package/dist/either/Either.js +1 -1
- package/dist/either/Either.mjs +1 -1
- package/dist/{index-B7vTndKq.d.ts → index-BT9-eytr.d.ts} +27 -3
- package/dist/{index-DzaLFl1L.d.mts → index-D2YBcdXR.d.mts} +27 -3
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/iterable/Seq.d.mts +3 -1
- package/dist/iterable/Seq.d.ts +3 -1
- package/dist/iterable/Seq.js +1 -1
- package/dist/iterable/Seq.mjs +1 -1
- package/dist/iterable/index.d.mts +3 -1
- package/dist/iterable/index.d.ts +3 -1
- package/dist/iterable/index.js +1 -1
- package/dist/iterable/index.mjs +1 -1
- package/dist/list/List.d.mts +3 -1
- package/dist/list/List.d.ts +3 -1
- package/dist/list/List.js +1 -1
- package/dist/list/List.mjs +1 -1
- package/dist/map/Map.d.mts +3 -1
- package/dist/map/Map.d.ts +3 -1
- package/dist/map/Map.js +1 -1
- package/dist/map/Map.mjs +1 -1
- package/dist/option/Option.d.mts +3 -1
- package/dist/option/Option.d.ts +3 -1
- package/dist/option/Option.js +1 -1
- package/dist/option/Option.mjs +1 -1
- package/dist/set/Set.d.mts +3 -1
- package/dist/set/Set.d.ts +3 -1
- package/dist/set/Set.js +1 -1
- package/dist/set/Set.mjs +1 -1
- package/dist/try/Try.d.mts +3 -1
- package/dist/try/Try.d.ts +3 -1
- package/dist/try/Try.js +1 -1
- package/dist/try/Try.mjs +1 -1
- package/dist/util/index.d.mts +3 -1
- package/dist/util/index.d.ts +3 -1
- package/dist/util/index.js +1 -1
- package/dist/util/index.mjs +1 -1
- package/dist/valuable/Valuable.d.mts +6 -0
- package/dist/valuable/Valuable.d.ts +6 -0
- package/dist/valuable/Valuable.js +1 -0
- package/dist/valuable/Valuable.mjs +1 -0
- package/package.json +13 -9
- package/dist/chunk-V72GRMBG.js +0 -1
- package/dist/chunk-W5Z2N2E4.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/set/Set.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkETU42J57js = require('../chunk-ETU42J57.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-BNNK42JC.js');require('../chunk-SQWNJC6O.js');require('../chunk-5O6YELD3.js');require('../chunk-2U34DUZU.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');require('../chunk-K3EKBPQE.js');exports.Set = _chunkETU42J57js.f;
|
package/dist/set/Set.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as a}from"../chunk-
|
|
1
|
+
import{f as a}from"../chunk-JJLIOHWZ.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-JF5YGNCO.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-HD6YYUHO.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";import"../chunk-2ML63TYF.mjs";export{a as Set};
|
package/dist/try/Try.d.mts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { o as Try } from '../index-D2YBcdXR.mjs';
|
|
2
2
|
import '../typeable/Typeable.mjs';
|
|
3
3
|
import '../functor/index.mjs';
|
|
4
4
|
import '../identity/Identity.mjs';
|
|
5
5
|
import '../tuple/Tuple.mjs';
|
|
6
|
+
import '../valuable/Valuable.mjs';
|
|
7
|
+
import '../core/error/Throwable.mjs';
|
package/dist/try/Try.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { o as Try } from '../index-BT9-eytr.js';
|
|
2
2
|
import '../typeable/Typeable.js';
|
|
3
3
|
import '../functor/index.js';
|
|
4
4
|
import '../identity/Identity.js';
|
|
5
5
|
import '../tuple/Tuple.js';
|
|
6
|
+
import '../valuable/Valuable.js';
|
|
7
|
+
import '../core/error/Throwable.js';
|
package/dist/try/Try.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkETU42J57js = require('../chunk-ETU42J57.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-BNNK42JC.js');require('../chunk-SQWNJC6O.js');require('../chunk-5O6YELD3.js');require('../chunk-2U34DUZU.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');require('../chunk-K3EKBPQE.js');exports.Try = _chunkETU42J57js.w;
|
package/dist/try/Try.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{w as a}from"../chunk-JJLIOHWZ.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-JF5YGNCO.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-HD6YYUHO.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";import"../chunk-2ML63TYF.mjs";export{a as Try};
|
package/dist/util/index.d.mts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { E as Either } from '../index-
|
|
1
|
+
import { E as Either } from '../index-D2YBcdXR.mjs';
|
|
2
2
|
import { ParseError } from '../error/ParseError.mjs';
|
|
3
3
|
import '../functor/index.mjs';
|
|
4
4
|
import '../identity/Identity.mjs';
|
|
5
5
|
import '../tuple/Tuple.mjs';
|
|
6
6
|
import '../typeable/Typeable.mjs';
|
|
7
|
+
import '../valuable/Valuable.mjs';
|
|
8
|
+
import '../core/error/Throwable.mjs';
|
|
7
9
|
|
|
8
10
|
declare const parseNumber: (input: string) => Either<ParseError, number>;
|
|
9
11
|
|
package/dist/util/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { E as Either } from '../index-
|
|
1
|
+
import { E as Either } from '../index-BT9-eytr.js';
|
|
2
2
|
import { ParseError } from '../error/ParseError.js';
|
|
3
3
|
import '../functor/index.js';
|
|
4
4
|
import '../identity/Identity.js';
|
|
5
5
|
import '../tuple/Tuple.js';
|
|
6
6
|
import '../typeable/Typeable.js';
|
|
7
|
+
import '../valuable/Valuable.js';
|
|
8
|
+
import '../core/error/Throwable.js';
|
|
7
9
|
|
|
8
10
|
declare const parseNumber: (input: string) => Either<ParseError, number>;
|
|
9
11
|
|
package/dist/util/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkE6RS47F7js = require('../chunk-E6RS47F7.js');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkE6RS47F7js = require('../chunk-E6RS47F7.js');var _chunkETU42J57js = require('../chunk-ETU42J57.js');require('../chunk-OXLZ6UIZ.js');require('../chunk-BNNK42JC.js');require('../chunk-SQWNJC6O.js');require('../chunk-5O6YELD3.js');require('../chunk-2U34DUZU.js');require('../chunk-5VTXJIR3.js');require('../chunk-3VJERXBP.js');require('../chunk-XORABVON.js');require('../chunk-K3EKBPQE.js');var a=o=>{let r=parseInt(o,10);return isNaN(r)?_chunkETU42J57js.j.call(void 0, _chunkE6RS47F7js.a.call(void 0, `${r}`)):_chunkETU42J57js.i.call(void 0, r)};exports.parseNumber = a;
|
package/dist/util/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"../chunk-VK5GL6NM.mjs";import{i as e,j as t}from"../chunk-
|
|
1
|
+
import{a as s}from"../chunk-VK5GL6NM.mjs";import{i as e,j as t}from"../chunk-JJLIOHWZ.mjs";import"../chunk-2I2NKDFN.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-JF5YGNCO.mjs";import"../chunk-V7DKESTM.mjs";import"../chunk-HD6YYUHO.mjs";import"../chunk-377WQNCB.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-V2J3R5IU.mjs";import"../chunk-2ML63TYF.mjs";var a=o=>{let r=parseInt(o,10);return isNaN(r)?t(s(`${r}`)):e(r)};export{a as parseNumber};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});function t(e){return{value:e}}exports.Valuable = t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(e){return{value:e}}export{t as Valuable};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "functype",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.32",
|
|
4
4
|
"description": "A smallish functional library for TypeScript",
|
|
5
5
|
"author": "jordan.burke@gmail.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,23 +11,27 @@
|
|
|
11
11
|
"homepage": "https://github.com/jordanburke/functype#readme",
|
|
12
12
|
"url": "https://github.com/jordanburke/functype",
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@
|
|
15
|
-
"@
|
|
16
|
-
"@
|
|
17
|
-
"@
|
|
14
|
+
"@eslint/compat": "^1.2.1",
|
|
15
|
+
"@eslint/eslintrc": "^3.1.0",
|
|
16
|
+
"@eslint/js": "^9.13.0",
|
|
17
|
+
"@types/jest": "29.5.14",
|
|
18
|
+
"@types/node": "^22.8.0",
|
|
19
|
+
"@typescript-eslint/eslint-plugin": "^8.11.0",
|
|
20
|
+
"@typescript-eslint/parser": "^8.11.0",
|
|
18
21
|
"cross-env": "^7.0.3",
|
|
19
|
-
"eslint": "^
|
|
22
|
+
"eslint": "^9.13.0",
|
|
20
23
|
"eslint-config-prettier": "^9.1.0",
|
|
21
24
|
"eslint-plugin-import": "^2.31.0",
|
|
22
25
|
"eslint-plugin-prettier": "^5.2.1",
|
|
23
26
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
27
|
+
"globals": "^15.11.0",
|
|
24
28
|
"jest": "^29.7.0",
|
|
25
29
|
"prettier": "^3.3.3",
|
|
26
30
|
"rimraf": "^6.0.1",
|
|
27
31
|
"ts-jest": "^29.2.5",
|
|
28
32
|
"ts-node": "^10.9.2",
|
|
29
|
-
"tsup": "^8.3.
|
|
30
|
-
"typescript": "^5.6.
|
|
33
|
+
"tsup": "^8.3.4",
|
|
34
|
+
"typescript": "^5.6.3"
|
|
31
35
|
},
|
|
32
36
|
"main": "./dist/index.js",
|
|
33
37
|
"module": "./dist/index.mjs",
|
|
@@ -52,7 +56,7 @@
|
|
|
52
56
|
"build:prod": "tsc --noEmit && rimraf dist && cross-env NODE_ENV=production tsup",
|
|
53
57
|
"build:watch": "tsup --watch",
|
|
54
58
|
"build:publish": "pnpm build:prod && pnpm publish --access public",
|
|
55
|
-
"lint:fix": "eslint ./src --
|
|
59
|
+
"lint:fix": "eslint ./src --quiet --fix",
|
|
56
60
|
"lint:format": "prettier --loglevel warn --write \"./**/*.{ts,tsx,css,md,json}\" ",
|
|
57
61
|
"lint": "pnpm lint:format && pnpm lint:fix ",
|
|
58
62
|
"test": "tsc --noEmit && jest",
|
package/dist/chunk-V72GRMBG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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 _chunkOXLZ6UIZjs = require('./chunk-OXLZ6UIZ.js');var _chunkBNNK42JCjs = require('./chunk-BNNK42JC.js');var _chunk5VTXJIR3js = require('./chunk-5VTXJIR3.js');var _chunk3VJERXBPjs = require('./chunk-3VJERXBP.js');var _safestablestringify = require('safe-stable-stringify'); var _safestablestringify2 = _interopRequireDefault(_safestablestringify);var c=e=>{let t=_chunkBNNK42JCjs.a.call(void 0, e)?e:e instanceof Object&&"toArray"in e?e.toArray():[],r=Array.from(t),f="Seq";return{[Symbol.iterator]:()=>r[Symbol.iterator](),get length(){return r.length},_tag:f,map:o=>c(r.map(o)),flatMap:o=>c(r.flatMap(n=>o(n).toArray())),forEach:o=>r.forEach(o),count:o=>r.filter(o).length,exists:o=>r.some(o),filter:o=>c(r.filter(o)),filterNot:o=>c(r.filter(n=>!o(n))),find:o=>L(r.find(o)),get head(){return r[0]},get headOption(){return r.length>0?L(r[0]):A()},get isEmpty(){return r.length===0},get size(){return r.length},toArray:()=>[...r],reduce:o=>r.reduce(o),reduceRight:o=>r.reduceRight(o),foldLeft:o=>n=>r.reduce(n,o),foldRight:o=>n=>r.reduceRight((u,U)=>n(U,u),o),toString:()=>`Seq(${_safestablestringify2.default.call(void 0, e)})`,toValue:()=>({_tag:f,value:r})}},T= exports.e =e=>c(e);var R=e=>{let t=_chunkBNNK42JCjs.a.call(void 0, e)?new (0, _chunk3VJERXBPjs.a)(e):new (0, _chunk3VJERXBPjs.a)(_nullishCoalesce(_optionalChain([e, 'optionalAccess', _2 => _2.toArray, 'call', _3 => _3()]), () => ([]))),r=T(t),f={...r,add:o=>R([...t,o]),remove:o=>{let n=new (0, _chunk3VJERXBPjs.a)(t);return n.delete(o),R(n)},contains:o=>t.has(o),has:o=>t.has(o),map:o=>R(r.map(o)),flatMap:o=>R(r.flatMap(o)),toList:()=>p(t),toSet:()=>f,toString:()=>`Set(${Array.from(t).toString()})`};return f},x= exports.f =e=>R(e);var d=e=>{function t(n){return n!=null&&typeof n[Symbol.iterator]=="function"}let r=Array.isArray(e)?e:t(e)?Array.from(e):[],f=T(r),o={...f,_tag:"List",length:r.length,map:n=>d(r.map(n)),flatMap:n=>d(f.flatMap(n)),remove:n=>{let u=r.indexOf(n);return o.removeAt(u)},contains:n=>r.includes(n),add:n=>d([...r,n]),removeAt:n=>n<0||n>=r.length?o:d([...r.slice(0,n),...r.slice(n+1)]),get:n=>L(r[n]),concat:n=>d([...r,...n.toArray()]),toList:()=>o,toSet:()=>x(r),toValue:()=>({_tag:"List",value:r}),toString:()=>`List(${_safestablestringify2.default.call(void 0, p(r))})`};return new Proxy(o,{get(n,u){return typeof u=="symbol"||isNaN(Number(u))?n[u]:n.get(Number(u))}})},p= exports.g =e=>d(e),j= exports.h =e=>d(e);console.assert(j);var v=e=>({_tag:"Right",value:e,isLeft:()=>!1,isRight:()=>!0,getOrElse:t=>e,getOrThrow:()=>e,map:t=>s(t(e)),mapAsync:t=>t(e).then(r=>s(r)).catch(r=>Promise.resolve(i(r))),merge:t=>t.isLeft()?i(t.value):s([e,t.value]),flatMap:t=>t(e),flatMapAsync:t=>t(e).catch(r=>i(r)),toOption:()=>m(e),toList:()=>p([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()?i(r.value):s([r.value])},lazyMap:function*(t){yield s(t(e))},tap:t=>(t(e),s(e)),tapLeft:t=>s(e),mapLeft:t=>s(e),bimap:(t,r)=>s(r(e)),fold:(t,r)=>r(e),swap:()=>i(e),then:(t,r)=>Promise.resolve(e).then(t,r)}),V=e=>({_tag:"Left",value:e,isLeft:()=>!0,isRight:()=>!1,getOrElse:t=>t,getOrThrow:()=>{throw e},map:t=>i(e),mapAsync:t=>Promise.resolve(i(e)),merge:t=>i(e),flatMap:t=>i(e),flatMapAsync:t=>Promise.resolve(i(e)),toOption:()=>A(),toList:()=>p(),toString:()=>`Left(${_safestablestringify2.default.call(void 0, e)})`,[Symbol.iterator]:function*(){},yield:function*(){},traverse:t=>i(e),lazyMap:function*(t){yield i(e)},tap:t=>i(e),tapLeft:t=>(t(e),i(e)),mapLeft:t=>i(t(e)),bimap:(t,r)=>i(t(e)),fold:(t,r)=>t(e),swap:()=>s(e),then:(t,r)=>Promise.reject(e).then(null,r)}),s= exports.i =e=>v(e),i= exports.j =e=>V(e),Ee= exports.k =e=>e.isRight(),xe= exports.l =e=>e.isLeft(),Ue= exports.m =(e,t)=>{try{return s(e())}catch(r){return i(t(r))}},G= exports.n =e=>v(e);console.assert(G);var D=e=>V(e);console.assert(D);var Be=async(e,t)=>{try{let r=await e();return s(r)}catch(r){return i(t(r))}},Se= exports.q =(e,t)=>{try{return s(e())}catch(r){return i(t(r))}},H= exports.r ={sequence:e=>{let t=[];for(let r of e){if(r.isLeft())return i(r.value);t.push(r.value)}return s(t)},traverse:(e,t)=>H.sequence(e.map(t)),fromNullable:(e,t)=>e==null?i(t):s(e),fromPredicate:(e,t,r)=>t(e)?s(e):i(r),ap:(e,t)=>e.flatMap(r=>t.map(r)),fromPromise:async(e,t)=>{try{let r=await e;return s(r)}catch(r){return i(t(r))}}};var y=e=>{let t={values:new (0, _chunk5VTXJIR3js.a)(e)},r=()=>Array.from(t.values.entries()).map(([a,l])=>_chunkOXLZ6UIZjs.a.call(void 0, [a,l])),f=a=>y(new (0, _chunk5VTXJIR3js.a)(t.values).set(a.toArray()[0],a.toArray()[1]).entries()),o=a=>{let l=new (0, _chunk5VTXJIR3js.a)(t.values);return l.delete(a)?y(l.entries()):y(t.values.entries())},n=a=>t.values.get(a[0])===a[1],u=()=>t.values.size,U=a=>y(Array.from(t.values.entries()).map(([l,F])=>[l,a(F)])),I=a=>{let l=y(t.values.entries()).toList();return y(l.flatMap(a).toArray())},M=a=>T(r()).reduce(a),w=a=>T(r()).reduceRight(a),P=a=>l=>T(r()).foldLeft(a)(l),k=a=>l=>T(r()).foldRight(a)(l),q=a=>L(t.values.get(a)),z=(a,l)=>L(t.values.get(a)).getOrElse(l),N=()=>t.values.size===0;return{add:f,remove:o,contains:n,get size(){return u()},map:U,flatMap:I,reduce:M,reduceRight:w,foldLeft:P,foldRight:k,get:q,getOrElse:z,get isEmpty(){return N()},orElse:(a,l)=>L(t.values.get(a)).orElse(l),toList:()=>p(r()),toSet:()=>x(r()),toString:()=>`Map(${r().toString()})`}},ke= exports.s =e=>y(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:()=>s(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:()=>i(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 m=e=>({_tag:"Some",value:e,isEmpty:!1,get:()=>e,getOrElse:()=>e,orElse:()=>m(e),map:t=>m(t(e)),filter(t){return t(e)?m(e):h},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:()=>p([e]),contains:t=>t===e,size:1,toEither:t=>s(e),toString:()=>`Some(${_safestablestringify2.default.call(void 0, e)})`,toValue:()=>({_tag:"Some",value:e})}),h={_tag:"None",value:void 0,isEmpty:!0,get:()=>{throw new Error("Cannot call get() on None")},getOrElse:e=>e,orElse:e=>e,map:e=>h,filter(e){return h},flatMap:e=>h,reduce:()=>{},reduceRight:()=>{},foldLeft:e=>()=>e,foldRight:e=>()=>e,toList:()=>p([]),contains:()=>!1,size:0,toEither:e=>i(e),toString:()=>"None",toValue:()=>({_tag:"None",value:void 0})},A= exports.b =()=>h,L= exports.c =e=>e!=null?m(e):A();exports.a = m; exports.b = A; exports.c = L; exports.d = c; exports.e = T; exports.f = x; exports.g = p; exports.h = j; exports.i = s; exports.j = i; exports.k = Ee; exports.l = xe; exports.m = Ue; exports.n = G; exports.o = D; exports.p = Be; exports.q = Se; exports.r = H; exports.s = ke; exports.t = J;
|
package/dist/chunk-W5Z2N2E4.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as S}from"./chunk-2I2NKDFN.mjs";import{a as g}from"./chunk-RRAIFS3D.mjs";import{a as E}from"./chunk-377WQNCB.mjs";import{a as b}from"./chunk-HA5XD5KC.mjs";import Q from"safe-stable-stringify";import _ from"safe-stable-stringify";import $ from"safe-stable-stringify";import C from"safe-stable-stringify";var c=e=>{let t=g(e)?e:e instanceof Object&&"toArray"in e?e.toArray():[],r=Array.from(t),f="Seq";return{[Symbol.iterator]:()=>r[Symbol.iterator](),get length(){return r.length},_tag:f,map:o=>c(r.map(o)),flatMap:o=>c(r.flatMap(n=>o(n).toArray())),forEach:o=>r.forEach(o),count:o=>r.filter(o).length,exists:o=>r.some(o),filter:o=>c(r.filter(o)),filterNot:o=>c(r.filter(n=>!o(n))),find:o=>L(r.find(o)),get head(){return r[0]},get headOption(){return r.length>0?L(r[0]):A()},get isEmpty(){return r.length===0},get size(){return r.length},toArray:()=>[...r],reduce:o=>r.reduce(o),reduceRight:o=>r.reduceRight(o),foldLeft:o=>n=>r.reduce(n,o),foldRight:o=>n=>r.reduceRight((u,U)=>n(U,u),o),toString:()=>`Seq(${C(e)})`,toValue:()=>({_tag:f,value:r})}},T=e=>c(e);var R=e=>{let t=g(e)?new b(e):new b(e?.toArray()??[]),r=T(t),f={...r,add:o=>R([...t,o]),remove:o=>{let n=new b(t);return n.delete(o),R(n)},contains:o=>t.has(o),has:o=>t.has(o),map:o=>R(r.map(o)),flatMap:o=>R(r.flatMap(o)),toList:()=>p(t),toSet:()=>f,toString:()=>`Set(${Array.from(t).toString()})`};return f},x=e=>R(e);var d=e=>{function t(n){return n!=null&&typeof n[Symbol.iterator]=="function"}let r=Array.isArray(e)?e:t(e)?Array.from(e):[],f=T(r),o={...f,_tag:"List",length:r.length,map:n=>d(r.map(n)),flatMap:n=>d(f.flatMap(n)),remove:n=>{let u=r.indexOf(n);return o.removeAt(u)},contains:n=>r.includes(n),add:n=>d([...r,n]),removeAt:n=>n<0||n>=r.length?o:d([...r.slice(0,n),...r.slice(n+1)]),get:n=>L(r[n]),concat:n=>d([...r,...n.toArray()]),toList:()=>o,toSet:()=>x(r),toValue:()=>({_tag:"List",value:r}),toString:()=>`List(${$(p(r))})`};return new Proxy(o,{get(n,u){return typeof u=="symbol"||isNaN(Number(u))?n[u]:n.get(Number(u))}})},p=e=>d(e),j=e=>d(e);console.assert(j);var v=e=>({_tag:"Right",value:e,isLeft:()=>!1,isRight:()=>!0,getOrElse:t=>e,getOrThrow:()=>e,map:t=>s(t(e)),mapAsync:t=>t(e).then(r=>s(r)).catch(r=>Promise.resolve(i(r))),merge:t=>t.isLeft()?i(t.value):s([e,t.value]),flatMap:t=>t(e),flatMapAsync:t=>t(e).catch(r=>i(r)),toOption:()=>m(e),toList:()=>p([e]),toString:()=>`Right(${_(e)})`,[Symbol.iterator]:function*(){yield e},yield:function*(){yield e},traverse:t=>{let r=t(e);return r.isLeft()?i(r.value):s([r.value])},lazyMap:function*(t){yield s(t(e))},tap:t=>(t(e),s(e)),tapLeft:t=>s(e),mapLeft:t=>s(e),bimap:(t,r)=>s(r(e)),fold:(t,r)=>r(e),swap:()=>i(e),then:(t,r)=>Promise.resolve(e).then(t,r)}),V=e=>({_tag:"Left",value:e,isLeft:()=>!0,isRight:()=>!1,getOrElse:t=>t,getOrThrow:()=>{throw e},map:t=>i(e),mapAsync:t=>Promise.resolve(i(e)),merge:t=>i(e),flatMap:t=>i(e),flatMapAsync:t=>Promise.resolve(i(e)),toOption:()=>A(),toList:()=>p(),toString:()=>`Left(${_(e)})`,[Symbol.iterator]:function*(){},yield:function*(){},traverse:t=>i(e),lazyMap:function*(t){yield i(e)},tap:t=>i(e),tapLeft:t=>(t(e),i(e)),mapLeft:t=>i(t(e)),bimap:(t,r)=>i(t(e)),fold:(t,r)=>t(e),swap:()=>s(e),then:(t,r)=>Promise.reject(e).then(null,r)}),s=e=>v(e),i=e=>V(e),Ee=e=>e.isRight(),xe=e=>e.isLeft(),Ue=(e,t)=>{try{return s(e())}catch(r){return i(t(r))}},G=e=>v(e);console.assert(G);var D=e=>V(e);console.assert(D);var Be=async(e,t)=>{try{let r=await e();return s(r)}catch(r){return i(t(r))}},Se=(e,t)=>{try{return s(e())}catch(r){return i(t(r))}},H={sequence:e=>{let t=[];for(let r of e){if(r.isLeft())return i(r.value);t.push(r.value)}return s(t)},traverse:(e,t)=>H.sequence(e.map(t)),fromNullable:(e,t)=>e==null?i(t):s(e),fromPredicate:(e,t,r)=>t(e)?s(e):i(r),ap:(e,t)=>e.flatMap(r=>t.map(r)),fromPromise:async(e,t)=>{try{let r=await e;return s(r)}catch(r){return i(t(r))}}};var y=e=>{let t={values:new E(e)},r=()=>Array.from(t.values.entries()).map(([a,l])=>S([a,l])),f=a=>y(new E(t.values).set(a.toArray()[0],a.toArray()[1]).entries()),o=a=>{let l=new E(t.values);return l.delete(a)?y(l.entries()):y(t.values.entries())},n=a=>t.values.get(a[0])===a[1],u=()=>t.values.size,U=a=>y(Array.from(t.values.entries()).map(([l,F])=>[l,a(F)])),I=a=>{let l=y(t.values.entries()).toList();return y(l.flatMap(a).toArray())},M=a=>T(r()).reduce(a),w=a=>T(r()).reduceRight(a),P=a=>l=>T(r()).foldLeft(a)(l),k=a=>l=>T(r()).foldRight(a)(l),q=a=>L(t.values.get(a)),z=(a,l)=>L(t.values.get(a)).getOrElse(l),N=()=>t.values.size===0;return{add:f,remove:o,contains:n,get size(){return u()},map:U,flatMap:I,reduce:M,reduceRight:w,foldLeft:P,foldRight:k,get:q,getOrElse:z,get isEmpty(){return N()},orElse:(a,l)=>L(t.values.get(a)).orElse(l),toList:()=>p(r()),toSet:()=>x(r()),toString:()=>`Map(${r().toString()})`}},ke=e=>y(e);import O 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:()=>s(e),map:t=>J(()=>t(e)),flatMap:t=>t(e),toString:()=>`Success(${O(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:()=>i(e),map:t=>B(e),flatMap:t=>B(e),toString:()=>`Failure(${O(e)}))`}),J=e=>{try{return K(e())}catch(t){return B(t instanceof Error?t:new Error(String(t)))}};var m=e=>({_tag:"Some",value:e,isEmpty:!1,get:()=>e,getOrElse:()=>e,orElse:()=>m(e),map:t=>m(t(e)),filter(t){return t(e)?m(e):h},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:()=>p([e]),contains:t=>t===e,size:1,toEither:t=>s(e),toString:()=>`Some(${Q(e)})`,toValue:()=>({_tag:"Some",value:e})}),h={_tag:"None",value:void 0,isEmpty:!0,get:()=>{throw new Error("Cannot call get() on None")},getOrElse:e=>e,orElse:e=>e,map:e=>h,filter(e){return h},flatMap:e=>h,reduce:()=>{},reduceRight:()=>{},foldLeft:e=>()=>e,foldRight:e=>()=>e,toList:()=>p([]),contains:()=>!1,size:0,toEither:e=>i(e),toString:()=>"None",toValue:()=>({_tag:"None",value:void 0})},A=()=>h,L=e=>e!=null?m(e):A();export{m as a,A as b,L as c,c as d,T as e,x as f,p as g,j as h,s as i,i as j,Ee as k,xe as l,Ue as m,G as n,D as o,Be as p,Se as q,H as r,ke as s,J as t};
|
package/lib/TaskPromise.d.ts
DELETED
package/lib/either/Either.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Functor, Type } from "../functor";
|
|
2
|
-
import { List } from "../list/List";
|
|
3
|
-
import { Option } from "../option/Option";
|
|
4
|
-
import { Typeable } from "../typeable/Typeable";
|
|
5
|
-
export type Either<L extends Type, R extends Type> = {
|
|
6
|
-
readonly _tag: "Left" | "Right";
|
|
7
|
-
value: L | R;
|
|
8
|
-
isLeft: () => boolean;
|
|
9
|
-
isRight: () => boolean;
|
|
10
|
-
getOrElse: (defaultValue: R) => R;
|
|
11
|
-
getOrThrow: () => R;
|
|
12
|
-
map: <U extends Type>(f: (value: R) => U) => Either<L, U>;
|
|
13
|
-
merge: <L1 extends Type, R1 extends Type>(other: Either<L1, R1>) => Either<L | L1, [R, R1]>;
|
|
14
|
-
mapAsync: <U extends Type>(f: (value: R) => Promise<U>) => Promise<Either<L, U>>;
|
|
15
|
-
flatMap: <U extends Type>(f: (value: R) => Either<L, U>) => Either<L, U>;
|
|
16
|
-
flatMapAsync: <U extends Type>(f: (value: R) => Promise<Either<L, U>>) => Promise<Either<L, U>>;
|
|
17
|
-
toOption: () => Option<R>;
|
|
18
|
-
toList: () => List<R>;
|
|
19
|
-
toString: () => string;
|
|
20
|
-
[Symbol.iterator]: () => Iterator<R>;
|
|
21
|
-
yield: () => Generator<R, void, unknown>;
|
|
22
|
-
traverse: <U extends Type>(f: (value: R) => Either<L, U>) => Either<L, U[]>;
|
|
23
|
-
lazyMap: <U extends Type>(f: (value: R) => U) => Generator<Either<L, U>, void, unknown>;
|
|
24
|
-
tap: (f: (value: R) => void) => Either<L, R>;
|
|
25
|
-
tapLeft: (f: (value: L) => void) => Either<L, R>;
|
|
26
|
-
mapLeft: <L2 extends Type>(f: (value: L) => L2) => Either<L2, R>;
|
|
27
|
-
bimap: <L2 extends Type, R2 extends Type>(fl: (value: L) => L2, fr: (value: R) => R2) => Either<L2, R2>;
|
|
28
|
-
fold: <T extends Type>(onLeft: (value: L) => T, onRight: (value: R) => T) => T;
|
|
29
|
-
swap: () => Either<R, L>;
|
|
30
|
-
} & Typeable<"Left" | "Right"> & PromiseLike<R>;
|
|
31
|
-
export type TestEither<L extends Type, R extends Type> = Either<L, R> & Functor<R>;
|
|
32
|
-
export declare const Right: <L extends Type, R extends Type>(value: R) => Either<L, R>;
|
|
33
|
-
export declare const Left: <L extends Type, R extends Type>(value: L) => Either<L, R>;
|
|
34
|
-
export declare const isRight: <L extends Type, R extends Type>(either: Either<L, R>) => either is Either<L, R> & {
|
|
35
|
-
value: R;
|
|
36
|
-
};
|
|
37
|
-
export declare const isLeft: <L extends Type, R extends Type>(either: Either<L, R>) => either is Either<L, R> & {
|
|
38
|
-
value: L;
|
|
39
|
-
};
|
|
40
|
-
export declare const tryCatch: <L extends Type, R extends Type>(f: () => R, onError: (error: unknown) => L) => Either<L, R>;
|
|
41
|
-
export declare const TypeCheckRight: <L extends Type, R extends Type>(value: R) => TestEither<L, R>;
|
|
42
|
-
export declare const TypeCheckLeft: <L extends Type, R extends Type>(value: L) => TestEither<L, R>;
|
|
43
|
-
export declare const tryCatchAsync: <L extends Type, R extends Type>(f: () => Promise<R>, onError: (error: unknown) => L) => Promise<Either<L, R>>;
|
|
44
|
-
export declare const tryCatchSync: <L extends Type, R extends Type>(f: () => R, onError: (error: unknown) => L) => Either<L, R>;
|
|
45
|
-
export declare const Either: {
|
|
46
|
-
sequence: <L extends Type, R extends Type>(eithers: Either<L, R>[]) => Either<L, R[]>;
|
|
47
|
-
traverse: <L extends Type, R extends Type, U extends Type>(arr: R[], f: (value: R) => Either<L, U>) => Either<L, U[]>;
|
|
48
|
-
fromNullable: <L extends Type, R extends Type>(value: R | null | undefined, leftValue: L) => Either<L, R>;
|
|
49
|
-
fromPredicate: <L extends Type, R extends Type>(value: R, predicate: (value: R) => boolean, leftValue: L) => Either<L, R>;
|
|
50
|
-
ap: <L extends Type, R extends Type, U extends Type>(eitherF: Either<L, (value: R) => U>, eitherV: Either<L, R>) => Either<L, U>;
|
|
51
|
-
fromPromise: <L, R>(promise: Promise<R>, onRejected: (reason: unknown) => L) => Promise<Either<L, R>>;
|
|
52
|
-
};
|
package/lib/either/EitherT.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Either } from "./Either";
|
|
2
|
-
export type EitherT<L, R> = {
|
|
3
|
-
value: Promise<Either<L, R>>;
|
|
4
|
-
map<U>(f: (value: R) => U): EitherT<L, U>;
|
|
5
|
-
flatMap<U>(f: (value: R) => EitherT<L, U>): EitherT<L, U>;
|
|
6
|
-
mapLeft<U>(f: (value: L) => U): EitherT<U, R>;
|
|
7
|
-
fold<U>(onLeft: (error: L) => U, onRight: (value: R) => U): Promise<U>;
|
|
8
|
-
};
|
|
9
|
-
export declare function EitherT<L, R>(value: Promise<Either<L, R>>): EitherT<L, R>;
|
package/lib/functor/index.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export type SingleType = unknown;
|
|
2
|
-
export type ArrayType = SingleType[];
|
|
3
|
-
export type Type = SingleType | ArrayType;
|
|
4
|
-
export type AbstractFunctor<A extends Type> = {
|
|
5
|
-
map(f: (value: A) => Type): AbstractFunctor<Type>;
|
|
6
|
-
flatMap(f: (value: A) => AbstractFunctor<Type>): AbstractFunctor<Type>;
|
|
7
|
-
};
|
|
8
|
-
export 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
|
-
export 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
|
-
};
|
package/lib/index.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Functor, Type } from "./functor";
|
|
2
|
-
export type Traversable<A extends Type> = Functor<A> & {
|
|
3
|
-
get size(): number;
|
|
4
|
-
get isEmpty(): boolean;
|
|
5
|
-
contains(value: A): boolean;
|
|
6
|
-
reduce(f: (b: A, a: A) => A): A;
|
|
7
|
-
reduceRight(f: (b: A, a: A) => A): A;
|
|
8
|
-
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
9
|
-
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
10
|
-
};
|
|
11
|
-
export * from "./either/Either";
|
|
12
|
-
export * from "./functor";
|
|
13
|
-
export * from "./identity/Identity";
|
|
14
|
-
export * from "./iterable";
|
|
15
|
-
export * from "./list/List";
|
|
16
|
-
export * from "./map/Map";
|
|
17
|
-
export * from "./option/Option";
|
|
18
|
-
export * from "./set/Set";
|
|
19
|
-
export * from "./try/Try";
|
|
20
|
-
export * from "./tuple/Tuple";
|
|
21
|
-
export * from "./typeable/Typeable";
|
package/lib/iterable/Seq.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Option } from "../option/Option";
|
|
2
|
-
import { Typeable } from "../typeable/Typeable";
|
|
3
|
-
import { _Iterable_ } from "./index";
|
|
4
|
-
export type Seq<A> = {
|
|
5
|
-
readonly length: number;
|
|
6
|
-
readonly [Symbol.iterator]: () => Iterator<A>;
|
|
7
|
-
map: <B>(f: (a: A) => B) => Seq<B>;
|
|
8
|
-
flatMap: <B>(f: (a: A) => _Iterable_<B>) => Seq<B>;
|
|
9
|
-
forEach: (f: (a: A) => void) => void;
|
|
10
|
-
count: (p: (x: A) => boolean) => number;
|
|
11
|
-
exists: (p: (a: A) => boolean) => boolean;
|
|
12
|
-
filter: (p: (a: A) => boolean) => Seq<A>;
|
|
13
|
-
filterNot: (p: (a: A) => boolean) => Seq<A>;
|
|
14
|
-
find: (p: (a: A) => boolean) => Option<A>;
|
|
15
|
-
readonly head: A;
|
|
16
|
-
readonly headOption: Option<A>;
|
|
17
|
-
readonly isEmpty: boolean;
|
|
18
|
-
readonly size: number;
|
|
19
|
-
toArray: () => A[];
|
|
20
|
-
reduce: (f: (prev: A, curr: A) => A) => A;
|
|
21
|
-
reduceRight: (f: (prev: A, curr: A) => A) => A;
|
|
22
|
-
foldLeft: <B>(z: B) => (op: (b: B, a: A) => B) => B;
|
|
23
|
-
foldRight: <B>(z: B) => (op: (a: A, b: B) => B) => B;
|
|
24
|
-
toString: () => string;
|
|
25
|
-
toValue: () => {
|
|
26
|
-
_tag: string;
|
|
27
|
-
value: A[];
|
|
28
|
-
};
|
|
29
|
-
} & _Iterable_<A> & Typeable<"Seq">;
|
|
30
|
-
export declare const createSeq: <A>(values?: Iterable<A> | _Iterable_<A>) => Seq<A>;
|
|
31
|
-
export declare const Seq: <A>(values?: Iterable<A> | _Iterable_<A>) => Seq<A>;
|
package/lib/iterable/index.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Functor, Type } from "../functor";
|
|
2
|
-
import { Option } from "../option/Option";
|
|
3
|
-
export type _Iterable_<A extends Type> = {
|
|
4
|
-
count(p: (x: A) => boolean): number;
|
|
5
|
-
find(p: (a: A) => boolean): Option<A>;
|
|
6
|
-
forEach(f: (a: A) => void): void;
|
|
7
|
-
exists(p: (a: A) => boolean): boolean;
|
|
8
|
-
filter(p: (a: A) => boolean): _Iterable_<A>;
|
|
9
|
-
filterNot(p: (a: A) => boolean): _Iterable_<A>;
|
|
10
|
-
reduce(f: (b: A, a: A) => A): A;
|
|
11
|
-
reduceRight(f: (b: A, a: A) => A): A;
|
|
12
|
-
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
13
|
-
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
14
|
-
get head(): A;
|
|
15
|
-
get headOption(): Option<A>;
|
|
16
|
-
get isEmpty(): boolean;
|
|
17
|
-
map<B extends Type>(f: (a: A) => B): _Iterable_<B>;
|
|
18
|
-
flatMap<B extends Type>(f: (a: A) => _Iterable_<B> | Iterable<B>): _Iterable_<B>;
|
|
19
|
-
get size(): number;
|
|
20
|
-
toArray(): readonly A[];
|
|
21
|
-
} & Functor<A>;
|
|
22
|
-
export { Seq } from "./Seq";
|
package/lib/list/List.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Collection } from "../collections";
|
|
2
|
-
import { _Iterable_, Seq } from "../iterable";
|
|
3
|
-
import { Option } from "../option/Option";
|
|
4
|
-
import { Set } from "../set/Set";
|
|
5
|
-
import { Typeable } from "../typeable/Typeable";
|
|
6
|
-
export type List<A> = {
|
|
7
|
-
add: (item: A) => List<A>;
|
|
8
|
-
map: <B>(f: (a: A) => B) => List<B>;
|
|
9
|
-
flatMap: <B>(f: (a: A) => _Iterable_<B>) => List<B>;
|
|
10
|
-
remove: (value: A) => List<A>;
|
|
11
|
-
contains: (value: A) => boolean;
|
|
12
|
-
removeAt: (index: number) => List<A>;
|
|
13
|
-
get: (index: number) => Option<A>;
|
|
14
|
-
concat: (other: List<A>) => List<A>;
|
|
15
|
-
toList: () => List<A>;
|
|
16
|
-
toSet: () => Set<A>;
|
|
17
|
-
toString: () => string;
|
|
18
|
-
toValue: () => {
|
|
19
|
-
_tag: string;
|
|
20
|
-
value: A[];
|
|
21
|
-
};
|
|
22
|
-
} & Seq<A> & Typeable<"List">;
|
|
23
|
-
type InternalList<A> = List<A> & ArrayLike<A> & _Iterable_<A> & Collection<A>;
|
|
24
|
-
export declare const List: <A>(values?: Iterable<A> | _Iterable_<A>) => List<A>;
|
|
25
|
-
export declare const TestList: <A>(values?: Iterable<A> | _Iterable_<A>) => InternalList<A>;
|
|
26
|
-
export {};
|
package/lib/map/Map.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Collection } from "../collections";
|
|
2
|
-
import { Traversable } from "../index";
|
|
3
|
-
import { _Iterable_ } from "../iterable";
|
|
4
|
-
import { Option } from "../option/Option";
|
|
5
|
-
import { Tuple } from "../tuple/Tuple";
|
|
6
|
-
type SafeTraversable<K, V> = Omit<Traversable<Tuple<[K, V]>>, "map" | "flatMap">;
|
|
7
|
-
export type Map<K, V> = {
|
|
8
|
-
add(item: Tuple<[K, V]>): Map<K, V>;
|
|
9
|
-
remove(value: K): Map<K, V>;
|
|
10
|
-
map<U>(f: (value: V) => U): Map<K, U>;
|
|
11
|
-
flatMap<K2, V2>(f: (entry: Tuple<[K, V]>) => _Iterable_<[K2, V2]>): Map<K2, V2>;
|
|
12
|
-
get(key: K): Option<V>;
|
|
13
|
-
getOrElse(key: K, defaultValue: V): V;
|
|
14
|
-
orElse(key: K, alternative: Option<V>): Option<V>;
|
|
15
|
-
} & SafeTraversable<K, V> & Collection<Tuple<[K, V]>>;
|
|
16
|
-
export declare const Map: <K, V>(entries?: readonly (readonly [K, V])[] | IterableIterator<[K, V]> | null) => Map<K, V>;
|
|
17
|
-
export {};
|
package/lib/map/shim.d.ts
DELETED
package/lib/option/Option.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Functor, Type } from "../functor";
|
|
2
|
-
import { Either, List, Traversable } from "../index";
|
|
3
|
-
import { Typeable } from "../typeable/Typeable";
|
|
4
|
-
export type Option<T extends Type> = {
|
|
5
|
-
readonly _tag: "Some" | "None";
|
|
6
|
-
readonly value: T | undefined;
|
|
7
|
-
isEmpty: boolean;
|
|
8
|
-
get(): T;
|
|
9
|
-
getOrElse(defaultValue: T): T;
|
|
10
|
-
orElse(alternative: Option<T>): Option<T>;
|
|
11
|
-
map<U extends Type>(f: (value: T) => U): Option<U>;
|
|
12
|
-
filter(predicate: (value: T) => boolean): Option<T>;
|
|
13
|
-
flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
|
|
14
|
-
reduce<U>(f: (acc: U, value: T) => U): U;
|
|
15
|
-
reduceRight<U>(f: (acc: U, value: T) => U): U;
|
|
16
|
-
foldLeft<B>(z: B): (op: (b: B, a: T) => B) => B;
|
|
17
|
-
foldRight<B>(z: B): (op: (a: T, b: B) => B) => B;
|
|
18
|
-
toList(): List<T>;
|
|
19
|
-
contains(value: T): boolean;
|
|
20
|
-
size: number;
|
|
21
|
-
toEither<E>(left: E): Either<E, T>;
|
|
22
|
-
toString(): string;
|
|
23
|
-
toValue(): {
|
|
24
|
-
_tag: "Some" | "None";
|
|
25
|
-
value: T;
|
|
26
|
-
};
|
|
27
|
-
} & (Traversable<T> & Functor<T> & Typeable<"Some" | "None">);
|
|
28
|
-
export declare const Some: <T extends Type>(value: T) => Option<T>;
|
|
29
|
-
export declare const None: <T extends Type>() => Option<T>;
|
|
30
|
-
export declare const Option: <T extends Type>(value: T | null | undefined) => Option<T>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export type SerializableTypes = "json" | "yaml";
|
|
2
|
-
type SerializationMethods<T> = {
|
|
3
|
-
json: {
|
|
4
|
-
toJSON(): string;
|
|
5
|
-
fromJSON(json: string): T;
|
|
6
|
-
};
|
|
7
|
-
yaml: {
|
|
8
|
-
toYAML(): string;
|
|
9
|
-
fromYAML(yaml: string): T;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export type Serializable<STypes extends SerializableTypes[], T> = T & (STypes extends [] ? NonNullable<unknown> : STypes extends [infer First, ...infer Rest] ? First extends keyof SerializationMethods<T> ? SerializationMethods<T>[First] & Serializable<Rest extends SerializableTypes[] ? Rest : [], T> : never : never);
|
|
13
|
-
export type SupportedSerializationTypes<T> = T extends Serializable<infer Types, never> ? Types : never;
|
|
14
|
-
export declare function createSerializable<STypes extends SerializableTypes[], T>(obj: T, serializationMethods: Pick<SerializationMethods<T>, STypes[number]>): Serializable<STypes, T>;
|
|
15
|
-
export {};
|
package/lib/set/Set.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Collection } from "../collections";
|
|
2
|
-
import { _Iterable_ } from "../iterable";
|
|
3
|
-
import { List } from "../list/List";
|
|
4
|
-
export type Set<A> = {
|
|
5
|
-
add: (value: A) => Set<A>;
|
|
6
|
-
remove: (value: A) => Set<A>;
|
|
7
|
-
contains: (value: A) => boolean;
|
|
8
|
-
has: (value: A) => boolean;
|
|
9
|
-
map: <B>(f: (a: A) => B) => Set<B>;
|
|
10
|
-
flatMap: <B>(f: (a: A) => _Iterable_<B>) => Set<B>;
|
|
11
|
-
toList: () => List<A>;
|
|
12
|
-
toSet: () => Set<A>;
|
|
13
|
-
toString: () => string;
|
|
14
|
-
} & _Iterable_<A> & Collection<A>;
|
|
15
|
-
export declare const Set: <A>(iterable?: Iterable<A> | _Iterable_<A>) => Set<A>;
|
package/lib/set/shim.d.ts
DELETED
package/lib/try/Try.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Either } from "../either/Either";
|
|
2
|
-
import { Typeable } from "../typeable/Typeable";
|
|
3
|
-
export type Try<T> = {
|
|
4
|
-
readonly _tag: "Success" | "Failure";
|
|
5
|
-
readonly value: T | undefined;
|
|
6
|
-
readonly error: Error | undefined;
|
|
7
|
-
isSuccess: () => boolean;
|
|
8
|
-
isFailure: () => boolean;
|
|
9
|
-
get: () => T;
|
|
10
|
-
getOrElse: (defaultValue: T) => T;
|
|
11
|
-
orElse: (alternative: Try<T>) => Try<T>;
|
|
12
|
-
orThrow: (error: Error) => T;
|
|
13
|
-
toEither: () => Either<Error, T>;
|
|
14
|
-
map: <U>(f: (value: T) => U) => Try<U>;
|
|
15
|
-
flatMap: <U>(f: (value: T) => Try<U>) => Try<U>;
|
|
16
|
-
toString: () => string;
|
|
17
|
-
} & Typeable<"Success" | "Failure">;
|
|
18
|
-
export declare const Try: <T>(f: () => T) => Try<T>;
|
package/lib/tuple/Tuple.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ArrayFunctor, ArrayType } from "../functor";
|
|
2
|
-
export type Tuple<T extends ArrayType> = {
|
|
3
|
-
get<K extends number>(index: K): T[K];
|
|
4
|
-
map<U extends ArrayType>(f: (value: T) => U): Tuple<U>;
|
|
5
|
-
flatMap<U extends ArrayType>(f: (value: T) => Tuple<U>): Tuple<U>;
|
|
6
|
-
toArray(): T;
|
|
7
|
-
[Symbol.iterator](): Iterator<T[number]>;
|
|
8
|
-
} & ArrayFunctor<T>;
|
|
9
|
-
export declare const Tuple: <T extends ArrayType>(values: T) => Tuple<T>;
|
package/lib/util/index.d.ts
DELETED
package/lib/util/isIterable.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isIterable: <T>(value: unknown) => value is Iterable<T>;
|