functype 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2XH6TPQK.mjs +1 -0
- package/dist/chunk-4P46BMZQ.js +1 -0
- package/dist/chunk-7JTQ2BTE.mjs +1 -0
- package/dist/chunk-CPB6NX2S.js +1 -0
- package/dist/chunk-GZIDEEAG.mjs +1 -0
- package/dist/chunk-HF33BEHO.js +1 -0
- package/dist/chunk-LLZGG3YT.js +1 -0
- package/dist/{chunk-ZTTAUZK3.js → chunk-LO5XBCIY.js} +1 -1
- package/dist/chunk-OLJYBLCT.js +1 -0
- package/dist/{chunk-LGUIG2RX.mjs → chunk-S5YAJ7CP.mjs} +1 -1
- package/dist/chunk-SPNWCOGV.mjs +1 -0
- package/dist/chunk-UVR6IELR.mjs +1 -0
- package/dist/chunk-V5UFW2E4.js +1 -0
- package/dist/{chunk-X52Z6M5P.mjs → chunk-WMSIRQ3W.mjs} +1 -1
- package/dist/collections/index.d.mts +1 -1
- package/dist/collections/index.d.ts +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/either/index.d.mts +1 -1
- package/dist/either/index.d.ts +1 -1
- package/dist/either/index.js +1 -1
- package/dist/either/index.mjs +1 -1
- package/dist/error/ParseError.js +1 -1
- package/dist/error/ParseError.mjs +1 -1
- package/dist/functor/index.d.mts +13 -13
- package/dist/functor/index.d.ts +13 -13
- package/dist/index-BSx1ncJ9.d.ts +231 -0
- package/dist/index-uP_Hoh2D.d.mts +231 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/iterable/Seq.d.mts +1 -1
- package/dist/iterable/Seq.d.ts +1 -1
- package/dist/iterable/Seq.js +1 -1
- package/dist/iterable/Seq.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/list/index.d.mts +1 -1
- package/dist/list/index.d.ts +1 -1
- package/dist/list/index.js +1 -1
- package/dist/list/index.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/map/index.d.mts +1 -1
- package/dist/map/index.d.ts +1 -1
- package/dist/map/index.js +1 -1
- package/dist/map/index.mjs +1 -1
- package/dist/map/shim.d.mts +1 -1
- package/dist/map/shim.d.ts +1 -1
- package/dist/map/shim.js +1 -1
- package/dist/map/shim.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/option/index.d.mts +1 -1
- package/dist/option/index.d.ts +1 -1
- package/dist/option/index.js +1 -1
- package/dist/option/index.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/set/index.d.mts +1 -1
- package/dist/set/index.d.ts +1 -1
- package/dist/set/index.js +1 -1
- package/dist/set/index.mjs +1 -1
- package/dist/set/shim.d.mts +1 -1
- package/dist/set/shim.d.ts +1 -1
- package/dist/set/shim.js +1 -1
- package/dist/set/shim.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/try/index.d.mts +1 -1
- package/dist/try/index.d.ts +1 -1
- package/dist/try/index.js +1 -1
- package/dist/try/index.mjs +1 -1
- package/dist/tuple/Tuple.d.mts +7 -7
- package/dist/tuple/Tuple.d.ts +7 -7
- package/dist/tuple/Tuple.js +1 -1
- package/dist/tuple/Tuple.mjs +1 -1
- package/dist/tuple/index.d.mts +1 -1
- package/dist/tuple/index.d.ts +1 -1
- package/dist/tuple/index.js +1 -1
- package/dist/tuple/index.mjs +1 -1
- 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 +17 -17
- package/dist/chunk-3RJPXVXE.js +0 -1
- package/dist/chunk-5DQWEDA3.js +0 -1
- package/dist/chunk-6RUUD24R.mjs +0 -1
- package/dist/chunk-BFK2RZ2Z.js +0 -1
- package/dist/chunk-BYPZZZTG.js +0 -1
- package/dist/chunk-DFWZ7ANA.mjs +0 -1
- package/dist/chunk-DP5G2LT6.mjs +0 -1
- package/dist/chunk-FQY6BMNG.js +0 -1
- package/dist/chunk-RMQF6I4T.mjs +0 -1
- package/dist/chunk-SDHW57XQ.js +0 -1
- package/dist/chunk-TAJ6OYCN.mjs +0 -1
- package/dist/index-3866f956.d.ts +0 -227
- package/dist/index-5f972212.d.ts +0 -227
- /package/dist/{chunk-VTKL7OQI.js → chunk-D22QKJZO.js} +0 -0
- /package/dist/{chunk-U5EUM74A.mjs → chunk-U37JTC3U.mjs} +0 -0
package/dist/try/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-Q4H3PCBH.mjs";import{a}from"../chunk-
|
|
1
|
+
import"../chunk-Q4H3PCBH.mjs";import{a}from"../chunk-SPNWCOGV.mjs";import"../chunk-GZIDEEAG.mjs";import"../chunk-S5YAJ7CP.mjs";import"../chunk-UVR6IELR.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-74TKYQJS.mjs";import"../chunk-WMSIRQ3W.mjs";import"../chunk-RRAIFS3D.mjs";import"../chunk-U37JTC3U.mjs";export{a as Try};
|
package/dist/tuple/Tuple.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ArrayType,
|
|
1
|
+
import { ArrayType, _ArrayFunctor_ } from '../functor/index.mjs';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type _Tuple_<T extends ArrayType> = _ArrayFunctor_<T> & {
|
|
4
4
|
get(index: number): T[number];
|
|
5
5
|
getAs<U>(index: number, f?: (item: T) => boolean): U;
|
|
6
|
-
map<U extends any[]>(f: (value: T) => U):
|
|
7
|
-
flatMap<U extends any[]>(f: (value: T) =>
|
|
8
|
-
}
|
|
9
|
-
declare class Tuple<T extends ArrayType> implements
|
|
6
|
+
map<U extends any[]>(f: (value: T) => U): _Tuple_<U>;
|
|
7
|
+
flatMap<U extends any[]>(f: (value: T) => _Tuple_<U>): _Tuple_<U>;
|
|
8
|
+
};
|
|
9
|
+
declare class Tuple<T extends ArrayType> implements _Tuple_<T> {
|
|
10
10
|
private readonly values;
|
|
11
11
|
constructor(values: T);
|
|
12
12
|
map<U extends ArrayType>(f: (value: T) => U): Tuple<U>;
|
|
@@ -16,4 +16,4 @@ declare class Tuple<T extends ArrayType> implements ITuple<T> {
|
|
|
16
16
|
toArray(): T;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export {
|
|
19
|
+
export { Tuple, type _Tuple_ };
|
package/dist/tuple/Tuple.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ArrayType,
|
|
1
|
+
import { ArrayType, _ArrayFunctor_ } from '../functor/index.js';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type _Tuple_<T extends ArrayType> = _ArrayFunctor_<T> & {
|
|
4
4
|
get(index: number): T[number];
|
|
5
5
|
getAs<U>(index: number, f?: (item: T) => boolean): U;
|
|
6
|
-
map<U extends any[]>(f: (value: T) => U):
|
|
7
|
-
flatMap<U extends any[]>(f: (value: T) =>
|
|
8
|
-
}
|
|
9
|
-
declare class Tuple<T extends ArrayType> implements
|
|
6
|
+
map<U extends any[]>(f: (value: T) => U): _Tuple_<U>;
|
|
7
|
+
flatMap<U extends any[]>(f: (value: T) => _Tuple_<U>): _Tuple_<U>;
|
|
8
|
+
};
|
|
9
|
+
declare class Tuple<T extends ArrayType> implements _Tuple_<T> {
|
|
10
10
|
private readonly values;
|
|
11
11
|
constructor(values: T);
|
|
12
12
|
map<U extends ArrayType>(f: (value: T) => U): Tuple<U>;
|
|
@@ -16,4 +16,4 @@ declare class Tuple<T extends ArrayType> implements ITuple<T> {
|
|
|
16
16
|
toArray(): T;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export {
|
|
19
|
+
export { Tuple, type _Tuple_ };
|
package/dist/tuple/Tuple.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkV5UFW2E4js = require('../chunk-V5UFW2E4.js');require('../chunk-D22QKJZO.js');exports.Tuple = _chunkV5UFW2E4js.a;
|
package/dist/tuple/Tuple.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-2XH6TPQK.mjs";import"../chunk-U37JTC3U.mjs";export{a as Tuple};
|
package/dist/tuple/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Tuple, _Tuple_ } from './Tuple.mjs';
|
|
2
2
|
import '../functor/index.mjs';
|
package/dist/tuple/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Tuple, _Tuple_ } from './Tuple.js';
|
|
2
2
|
import '../functor/index.js';
|
package/dist/tuple/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-TVZBBVEV.js');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-TVZBBVEV.js');var _chunkV5UFW2E4js = require('../chunk-V5UFW2E4.js');require('../chunk-D22QKJZO.js');exports.Tuple = _chunkV5UFW2E4js.a;
|
package/dist/tuple/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-LBQXRIXP.mjs";import{a}from"../chunk-
|
|
1
|
+
import"../chunk-LBQXRIXP.mjs";import{a}from"../chunk-2XH6TPQK.mjs";import"../chunk-U37JTC3U.mjs";export{a as Tuple};
|
package/dist/util/index.d.mts
CHANGED
package/dist/util/index.d.ts
CHANGED
package/dist/util/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 _chunkLLZGG3YTjs = require('../chunk-LLZGG3YT.js');require('../chunk-HF33BEHO.js');require('../chunk-CPB6NX2S.js');require('../chunk-3VJERXBP.js');require('../chunk-XVHCBGUW.js');require('../chunk-LO5XBCIY.js');require('../chunk-BNNK42JC.js');var _chunkZTL76QDLjs = require('../chunk-ZTL76QDL.js');require('../chunk-D22QKJZO.js');var n=s=>{let r=parseInt(s,10);return isNaN(r)?_chunkLLZGG3YTjs.a.call(void 0, new (0, _chunkZTL76QDLjs.a)(`${r}`)):_chunkLLZGG3YTjs.b.call(void 0, r)};exports.parseNumber = n;
|
package/dist/util/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,b as t}from"../chunk-
|
|
1
|
+
import{a as e,b as t}from"../chunk-GZIDEEAG.mjs";import"../chunk-S5YAJ7CP.mjs";import"../chunk-UVR6IELR.mjs";import"../chunk-HA5XD5KC.mjs";import"../chunk-74TKYQJS.mjs";import"../chunk-WMSIRQ3W.mjs";import"../chunk-RRAIFS3D.mjs";import{a as o}from"../chunk-CFYIJKWF.mjs";import"../chunk-U37JTC3U.mjs";var n=s=>{let r=parseInt(s,10);return isNaN(r)?e(new o(`${r}`)):t(r)};export{n as parseNumber};
|
package/dist/util/isIterable.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBNNK42JCjs = require('../chunk-BNNK42JC.js');require('../chunk-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBNNK42JCjs = require('../chunk-BNNK42JC.js');require('../chunk-D22QKJZO.js');exports.isIterable = _chunkBNNK42JCjs.a;
|
package/dist/util/isIterable.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-RRAIFS3D.mjs";import"../chunk-
|
|
1
|
+
import{a}from"../chunk-RRAIFS3D.mjs";import"../chunk-U37JTC3U.mjs";export{a as isIterable};
|
package/package.json
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "functype",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "A smallish functional library for TypeScript",
|
|
5
5
|
"author": "jordan.burke@gmail.com",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"url": "https://github.com/jordanburke/TypeScript/tree/main/functype",
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@types/node": "^
|
|
10
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
11
|
-
"@typescript-eslint/parser": "^
|
|
12
|
-
"@types/jest": "29.5.
|
|
9
|
+
"@types/node": "^20.12.8",
|
|
10
|
+
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
|
11
|
+
"@typescript-eslint/parser": "^7.5.0",
|
|
12
|
+
"@types/jest": "29.5.12",
|
|
13
13
|
"cross-env": "^7.0.3",
|
|
14
|
-
"eslint": "^8.
|
|
15
|
-
"eslint-config-prettier": "^9.
|
|
16
|
-
"eslint-plugin-import": "^2.
|
|
17
|
-
"eslint-plugin-prettier": "^5.
|
|
18
|
-
"eslint-plugin-simple-import-sort": "^
|
|
19
|
-
"jest": "29.
|
|
20
|
-
"prettier": "^3.
|
|
21
|
-
"rimraf": "^5.0.
|
|
22
|
-
"tsup": "^
|
|
23
|
-
"ts-jest": "^29.1.
|
|
24
|
-
"ts-node": "^10.9.
|
|
25
|
-
"typescript": "^5.
|
|
14
|
+
"eslint": "^8.57.0",
|
|
15
|
+
"eslint-config-prettier": "^9.1.0",
|
|
16
|
+
"eslint-plugin-import": "^2.29.1",
|
|
17
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
18
|
+
"eslint-plugin-simple-import-sort": "^12.0.0",
|
|
19
|
+
"jest": "29.7.0",
|
|
20
|
+
"prettier": "^3.2.5",
|
|
21
|
+
"rimraf": "^5.0.5",
|
|
22
|
+
"tsup": "^8.0.2",
|
|
23
|
+
"ts-jest": "^29.1.2",
|
|
24
|
+
"ts-node": "^10.9.2",
|
|
25
|
+
"typescript": "^5.4.5"
|
|
26
26
|
},
|
|
27
27
|
"main": "./dist/index.js",
|
|
28
28
|
"module": "./dist/index.mjs",
|
package/dist/chunk-3RJPXVXE.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBFK2RZ2Zjs = require('./chunk-BFK2RZ2Z.js');var _chunkVTKL7OQIjs = require('./chunk-VTKL7OQI.js');var o=class s{constructor(r,e){_chunkVTKL7OQIjs.a.call(void 0, this,"value");_chunkVTKL7OQIjs.a.call(void 0, this,"error");this.value=r,this.error=e}static of(r){try{return new s(r(),null)}catch(e){return new s(null,e instanceof Error?e:new Error(String(e)))}}isSuccess(){return this.error===null}isFailure(){return this.error!==null}getOrElse(r){return this.isSuccess()?this.value:r}orElse(r){return this.isSuccess()?this:r}toEither(){return this.isSuccess()?new (0, _chunkBFK2RZ2Zjs.a)(this.value):new (0, _chunkBFK2RZ2Zjs.b)(this.error)}};exports.a = o;
|
package/dist/chunk-5DQWEDA3.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkFQY6BMNGjs = require('./chunk-FQY6BMNG.js');var _chunk5VTXJIR3js = require('./chunk-5VTXJIR3.js');var _chunkSDHW57XQjs = require('./chunk-SDHW57XQ.js');var _chunkZTTAUZK3js = require('./chunk-ZTTAUZK3.js');var _chunkVTKL7OQIjs = require('./chunk-VTKL7OQI.js');var i=class n{constructor(e){_chunkVTKL7OQIjs.a.call(void 0, this,"values");this.values=new (0, _chunk5VTXJIR3js.a)(e)}get entries(){return Array.from(this.values.entries()).map(([e,t])=>new (0, _chunkFQY6BMNGjs.a)([e,t]))}add(e){return new n(this.values.set(e[0],e[1]).entries())}remove(e){let t=new n([...this.values.entries()]);return t.values.delete(e[0])?t:this}contains(e){return this.values.get(e[0])===e[1]}get size(){return this.values.size}map(e){let t=[];for(let[r,l]of this.values.entries())t.push([r,e(l)]);return new n(t)}flatMap(e){let t=[];for(let[r,l]of this.values.entries()){let u=e(l);if(u instanceof n)for(let[I,v]of u.values.entries())t.push([I,v])}return new n(t)}reduce(e){return new (0, _chunkZTTAUZK3js.f)(this.entries).reduce(e)}reduceRight(e){return new (0, _chunkZTTAUZK3js.f)(this.entries).reduceRight(e)}foldLeft(e){let t=new (0, _chunkZTTAUZK3js.f)(this.entries);return r=>t.foldLeft(e)(r)}foldRight(e){let t=new (0, _chunkZTTAUZK3js.f)(this.entries);return r=>t.foldRight(e)(r)}get(e){return _chunkZTTAUZK3js.c.call(void 0, this.values.get(e))}getOrElse(e,t){return _chunkZTTAUZK3js.c.call(void 0, this.values.get(e)).getOrElse(t)}get isEmpty(){return this.values.size===0}orElse(e,t){let r=_chunkZTTAUZK3js.c.call(void 0, this.values.get(e));return t}toList(){return new (0, _chunkSDHW57XQjs.b)(this.entries)}toSet(){return new (0, _chunkSDHW57XQjs.a)(this.entries)}},b=new i([["a",1],["b",2],["c",3]]);exports.a = i;
|
package/dist/chunk-6RUUD24R.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-HA5XD5KC.mjs";import{c as A,f as s}from"./chunk-X52Z6M5P.mjs";var o=class e extends s{constructor(t){super(t)}map(t){return new e(super.map(t).toArray())}flatMap(t){return new e(super.flatMap(t).toArray())}remove(t){let i=new e().toArray().indexOf(t);return this.removeAt(i)}contains(t){return this.toArray().indexOf(t)!==-1}add(t){let i=[...this.toArray(),t];return new e(i)}removeAt(t){if(t<0||t>=this.toArray().length)return this;let r=[...this.toArray().slice(0,t),...this.toArray().slice(t+1)];return new e(r)}get(t){return A(this.toArray()[t])}concat(t){return new e([...this.toArray(),...t.toArray()])}toList(){return this}toSet(){return new n(this.toArray())}toString(){return`List(${this.toArray().toString()})`}};var L=e=>new o(e);var n=class e extends s{constructor(t){super(new a(t))}add(t){return new e([...this.values,t])}remove(t){let r=new a;return r.delete(t)?new e(r):this}contains(t){return this.has(t)}has(t){return this.values.has(t)}map(t){return new e(super.map(t).toArray())}flatMap(t){return new e(super.flatMap(t).toArray())}toList(){return new o(this.toArray())}toSet(){return this}};export{n as a,o as b,L as c};
|
package/dist/chunk-BFK2RZ2Z.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkSDHW57XQjs = require('./chunk-SDHW57XQ.js');var _chunkZTTAUZK3js = require('./chunk-ZTTAUZK3.js');var L=class e{constructor(t){this.value=t}isLeft(){return!1}isRight(){return!0}map(t){return new e(t(this.value))}flatMap(t){return t(this.value)}toOption(){return _chunkZTTAUZK3js.d.call(void 0, this.value)}toList(){return new (0, _chunkSDHW57XQjs.b)([this.value])}},u= exports.b =class e{constructor(t){this.value=t}isLeft(){return!0}isRight(){return!1}map(t){return new e(this.value)}flatMap(t){return new e(this.value)}toOption(){return _chunkZTTAUZK3js.e.call(void 0, )}toList(){return new _chunkSDHW57XQjs.b}};exports.a = L; exports.b = u;
|
package/dist/chunk-BYPZZZTG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBFK2RZ2Zjs = require('./chunk-BFK2RZ2Z.js');var L=t=>new (0, _chunkBFK2RZ2Zjs.b)(t),R= exports.b =t=>new (0, _chunkBFK2RZ2Zjs.a)(t);exports.a = L; exports.b = R;
|
package/dist/chunk-DFWZ7ANA.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,b as r}from"./chunk-LGUIG2RX.mjs";var L=t=>new r(t),R=t=>new e(t);export{L as a,R as b};
|
package/dist/chunk-DP5G2LT6.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as f}from"./chunk-RMQF6I4T.mjs";import{a as V}from"./chunk-377WQNCB.mjs";import{a as p,b as K}from"./chunk-6RUUD24R.mjs";import{c as a,f as s}from"./chunk-X52Z6M5P.mjs";import{a as o}from"./chunk-U5EUM74A.mjs";var i=class n{constructor(e){o(this,"values");this.values=new V(e)}get entries(){return Array.from(this.values.entries()).map(([e,t])=>new f([e,t]))}add(e){return new n(this.values.set(e[0],e[1]).entries())}remove(e){let t=new n([...this.values.entries()]);return t.values.delete(e[0])?t:this}contains(e){return this.values.get(e[0])===e[1]}get size(){return this.values.size}map(e){let t=[];for(let[r,l]of this.values.entries())t.push([r,e(l)]);return new n(t)}flatMap(e){let t=[];for(let[r,l]of this.values.entries()){let u=e(l);if(u instanceof n)for(let[I,v]of u.values.entries())t.push([I,v])}return new n(t)}reduce(e){return new s(this.entries).reduce(e)}reduceRight(e){return new s(this.entries).reduceRight(e)}foldLeft(e){let t=new s(this.entries);return r=>t.foldLeft(e)(r)}foldRight(e){let t=new s(this.entries);return r=>t.foldRight(e)(r)}get(e){return a(this.values.get(e))}getOrElse(e,t){return a(this.values.get(e)).getOrElse(t)}get isEmpty(){return this.values.size===0}orElse(e,t){let r=a(this.values.get(e));return t}toList(){return new K(this.entries)}toSet(){return new p(this.entries)}},b=new i([["a",1],["b",2],["c",3]]);export{i as a};
|
package/dist/chunk-FQY6BMNG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var t=class n{constructor(e){this.values=e}map(e){let r=e(this.values);return new n(r)}flatMap(e){return e(this.values)}get(e){return this.values[e]}getAs(e,r){let a=this.values[e];if(r){if(r(this.values))return a;throw new Error("Cannot cast tuple value")}else return a}toArray(){return this.values}};exports.a = t;
|
package/dist/chunk-RMQF6I4T.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t=class n{constructor(e){this.values=e}map(e){let r=e(this.values);return new n(r)}flatMap(e){return e(this.values)}get(e){return this.values[e]}getAs(e,r){let a=this.values[e];if(r){if(r(this.values))return a;throw new Error("Cannot cast tuple value")}else return a}toArray(){return this.values}};export{t as a};
|
package/dist/chunk-SDHW57XQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3VJERXBPjs = require('./chunk-3VJERXBP.js');var _chunkZTTAUZK3js = require('./chunk-ZTTAUZK3.js');var o=class e extends _chunkZTTAUZK3js.f{constructor(t){super(t)}map(t){return new e(super.map(t).toArray())}flatMap(t){return new e(super.flatMap(t).toArray())}remove(t){let i=new e().toArray().indexOf(t);return this.removeAt(i)}contains(t){return this.toArray().indexOf(t)!==-1}add(t){let i=[...this.toArray(),t];return new e(i)}removeAt(t){if(t<0||t>=this.toArray().length)return this;let r=[...this.toArray().slice(0,t),...this.toArray().slice(t+1)];return new e(r)}get(t){return _chunkZTTAUZK3js.c.call(void 0, this.toArray()[t])}concat(t){return new e([...this.toArray(),...t.toArray()])}toList(){return this}toSet(){return new n(this.toArray())}toString(){return`List(${this.toArray().toString()})`}};var L=e=>new o(e);var n=class e extends _chunkZTTAUZK3js.f{constructor(t){super(new (0, _chunk3VJERXBPjs.a)(t))}add(t){return new e([...this.values,t])}remove(t){let r=new _chunk3VJERXBPjs.a;return r.delete(t)?new e(r):this}contains(t){return this.has(t)}has(t){return this.values.has(t)}map(t){return new e(super.map(t).toArray())}flatMap(t){return new e(super.flatMap(t).toArray())}toList(){return new o(this.toArray())}toSet(){return this}};exports.a = n; exports.b = o; exports.c = L;
|
package/dist/chunk-TAJ6OYCN.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as l,b as i}from"./chunk-LGUIG2RX.mjs";import{a as t}from"./chunk-U5EUM74A.mjs";var o=class s{constructor(r,e){t(this,"value");t(this,"error");this.value=r,this.error=e}static of(r){try{return new s(r(),null)}catch(e){return new s(null,e instanceof Error?e:new Error(String(e)))}}isSuccess(){return this.error===null}isFailure(){return this.error!==null}getOrElse(r){return this.isSuccess()?this.value:r}orElse(r){return this.isSuccess()?this:r}toEither(){return this.isSuccess()?new l(this.value):new i(this.error)}};export{o as a};
|
package/dist/index-3866f956.d.ts
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import { Type, IFunctor } from './functor/index.js';
|
|
2
|
-
import { ITuple, Tuple } from './tuple/Tuple.js';
|
|
3
|
-
|
|
4
|
-
interface Option<T extends Type> extends IFunctor<T>, ITraversable<T> {
|
|
5
|
-
get(): T;
|
|
6
|
-
getOrElse(defaultValue: T): T;
|
|
7
|
-
orElse(alternative: Option<T>): Option<T>;
|
|
8
|
-
map<U extends Type>(f: (value: T) => U): Option<U>;
|
|
9
|
-
flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
|
|
10
|
-
toList(): IIterable<T>;
|
|
11
|
-
}
|
|
12
|
-
declare class Some<A extends Type> implements Option<A> {
|
|
13
|
-
private value;
|
|
14
|
-
constructor(value: A);
|
|
15
|
-
get isEmpty(): boolean;
|
|
16
|
-
get(): A;
|
|
17
|
-
getOrElse(defaultValue: A): A;
|
|
18
|
-
orElse(alternative: Option<A>): Option<A>;
|
|
19
|
-
map<U extends Type>(f: (value: A) => U): Option<U>;
|
|
20
|
-
flatMap<U extends Type>(f: (value: A) => Option<U>): Option<U>;
|
|
21
|
-
reduce<U>(f: (acc: U, value: A) => U): U;
|
|
22
|
-
reduceRight<U>(f: (acc: U, value: A) => U): U;
|
|
23
|
-
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
24
|
-
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
25
|
-
toList(): IIterable<A>;
|
|
26
|
-
contains(value: A): boolean;
|
|
27
|
-
get size(): number;
|
|
28
|
-
}
|
|
29
|
-
declare class None<A extends Type> implements Option<A> {
|
|
30
|
-
get isEmpty(): boolean;
|
|
31
|
-
get(): A;
|
|
32
|
-
getOrElse(defaultValue: A): A;
|
|
33
|
-
orElse(alternative: Option<A>): Option<A>;
|
|
34
|
-
map<U extends Type>(f: (value: A) => U): Option<U>;
|
|
35
|
-
flatMap<U extends Type>(f: (value: A) => Option<U>): Option<U>;
|
|
36
|
-
reduce(f: (acc: A, value: A) => A): A;
|
|
37
|
-
reduceRight(f: (b: A, a: A) => A): A;
|
|
38
|
-
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
39
|
-
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
40
|
-
toList(): IIterable<A>;
|
|
41
|
-
contains(value: A): boolean;
|
|
42
|
-
get size(): number;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
declare const option: <T extends unknown>(value?: T | undefined) => Option<T>;
|
|
46
|
-
declare const some: <T extends unknown>(value: T) => Option<T>;
|
|
47
|
-
declare const none: <T extends unknown>() => Option<T>;
|
|
48
|
-
|
|
49
|
-
declare class Seq<A> implements IIterable<A> {
|
|
50
|
-
protected readonly values: Iterable<A>;
|
|
51
|
-
constructor(values?: Iterable<A> | IIterable<A>);
|
|
52
|
-
readonly [n: number]: A;
|
|
53
|
-
get length(): number;
|
|
54
|
-
map<B>(f: (a: A) => B): IIterable<B>;
|
|
55
|
-
flatMap<B>(f: (a: A) => IIterable<B>): IIterable<B>;
|
|
56
|
-
forEach(f: (a: A) => void): void;
|
|
57
|
-
count(p: (x: A) => boolean): number;
|
|
58
|
-
exists(p: (a: A) => boolean): Boolean;
|
|
59
|
-
filter(p: (a: A) => boolean): IIterable<A>;
|
|
60
|
-
filterNot(p: (a: A) => boolean): IIterable<A>;
|
|
61
|
-
find(p: (a: A) => boolean): Option<A>;
|
|
62
|
-
get head(): A;
|
|
63
|
-
get headOption(): Option<A>;
|
|
64
|
-
get isEmpty(): boolean;
|
|
65
|
-
get size(): number;
|
|
66
|
-
toArray(): A[];
|
|
67
|
-
reduce(f: (prev: A, curr: A) => A): A;
|
|
68
|
-
reduceRight(f: (prev: A, curr: A) => A): A;
|
|
69
|
-
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
70
|
-
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
interface IIterable<A extends Type> extends IFunctor<A> {
|
|
74
|
-
count(p: (x: A) => boolean): number;
|
|
75
|
-
find(p: (a: A) => boolean): Option<A>;
|
|
76
|
-
forEach(f: (a: A) => void): void;
|
|
77
|
-
exists(p: (a: A) => boolean): Boolean;
|
|
78
|
-
filter(p: (a: A) => boolean): IIterable<A>;
|
|
79
|
-
filterNot(p: (a: A) => boolean): IIterable<A>;
|
|
80
|
-
reduce(f: (b: A, a: A) => A): A;
|
|
81
|
-
reduceRight(f: (b: A, a: A) => A): A;
|
|
82
|
-
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
83
|
-
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
84
|
-
get head(): A;
|
|
85
|
-
get headOption(): Option<A>;
|
|
86
|
-
get isEmpty(): boolean;
|
|
87
|
-
map<B extends Type>(f: (a: A) => B): IIterable<B>;
|
|
88
|
-
flatMap<B extends Type>(f: (a: A) => IIterable<B>): IIterable<B>;
|
|
89
|
-
get size(): number;
|
|
90
|
-
toArray(): readonly A[];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
interface ISet<T> extends IIterable<T>, ICollection<T> {
|
|
94
|
-
has(value: T): boolean;
|
|
95
|
-
}
|
|
96
|
-
declare class Set<A> extends Seq<A> implements ISet<A> {
|
|
97
|
-
constructor(iterable?: Iterable<A>);
|
|
98
|
-
add(value: A): Set<A>;
|
|
99
|
-
remove(value: A): Set<A>;
|
|
100
|
-
contains(value: A): boolean;
|
|
101
|
-
has(value: A): boolean;
|
|
102
|
-
map<B>(f: (a: A) => B): Set<B>;
|
|
103
|
-
flatMap<B>(f: (a: A) => IIterable<B>): Set<B>;
|
|
104
|
-
toList(): IList<A>;
|
|
105
|
-
toSet(): ISet<A>;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
interface IConverters<A> {
|
|
109
|
-
toList(): IList<A>;
|
|
110
|
-
toSet(): ISet<A>;
|
|
111
|
-
}
|
|
112
|
-
interface ICollection<A> extends IConverters<A> {
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
interface IList<T> extends IIterable<T>, ArrayLike<T> {
|
|
116
|
-
add(item: T): IList<T>;
|
|
117
|
-
}
|
|
118
|
-
declare class List<A> extends Seq<A> implements IList<A>, ICollection<A> {
|
|
119
|
-
constructor(values?: Iterable<A> | IIterable<A>);
|
|
120
|
-
readonly [n: number]: A;
|
|
121
|
-
map<B>(f: (a: A) => B): List<B>;
|
|
122
|
-
flatMap<B>(f: (a: A) => IIterable<B>): List<B>;
|
|
123
|
-
remove(value: A): List<A>;
|
|
124
|
-
contains(value: A): boolean;
|
|
125
|
-
add(item: A): List<A>;
|
|
126
|
-
removeAt(index: number): List<A>;
|
|
127
|
-
get(index: number): Option<A>;
|
|
128
|
-
concat(other: List<A>): List<A>;
|
|
129
|
-
toList(): IList<A>;
|
|
130
|
-
toSet(): Set<A>;
|
|
131
|
-
toString(): string;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
declare const list: <T extends unknown>(items: T[] | undefined) => List<T>;
|
|
135
|
-
|
|
136
|
-
interface IMap<K, V> extends ITraversable<ITuple<[K, V]>>, ICollection<ITuple<[K, V]>> {
|
|
137
|
-
map<U>(f: (value: any) => U): IMap<K, U>;
|
|
138
|
-
flatMap<U>(f: (value: any) => IMap<K, U>): IMap<K, U>;
|
|
139
|
-
get(key: K): Option<V>;
|
|
140
|
-
getOrElse(key: K, defaultValue: V): V;
|
|
141
|
-
orElse(key: K, alternative: Option<V>): Option<V>;
|
|
142
|
-
}
|
|
143
|
-
declare class Map<K, V> implements IMap<K, V> {
|
|
144
|
-
private values;
|
|
145
|
-
private get entries();
|
|
146
|
-
constructor(entries?: readonly (readonly [K, V])[] | IterableIterator<[K, V]> | null);
|
|
147
|
-
add(item: ITuple<[K, V]>): Map<K, V>;
|
|
148
|
-
remove(value: ITuple<[K, V]>): Map<K, V>;
|
|
149
|
-
contains(value: ITuple<[K, V]>): boolean;
|
|
150
|
-
get size(): number;
|
|
151
|
-
map<U>(f: (value: V) => U): IMap<K, U>;
|
|
152
|
-
flatMap<U>(f: (value: V) => IMap<K, U>): IMap<K, U>;
|
|
153
|
-
reduce(f: (acc: Tuple<[K, V]>, value: Tuple<[K, V]>) => Tuple<[K, V]>): Tuple<[K, V]>;
|
|
154
|
-
reduceRight(f: (acc: Tuple<[K, V]>, value: Tuple<[K, V]>) => Tuple<[K, V]>): Tuple<[K, V]>;
|
|
155
|
-
foldLeft<B>(z: B): (op: (b: B, a: ITuple<[K, V]>) => B) => B;
|
|
156
|
-
foldRight<B>(z: B): (op: (a: ITuple<[K, V]>, b: B) => B) => B;
|
|
157
|
-
get(key: K): Option<V>;
|
|
158
|
-
getOrElse(key: K, defaultValue: V): V;
|
|
159
|
-
get isEmpty(): boolean;
|
|
160
|
-
orElse(key: K, alternative: Option<V>): Option<V>;
|
|
161
|
-
toList(): IList<Tuple<[K, V]>>;
|
|
162
|
-
toSet(): ISet<Tuple<[K, V]>>;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
interface Either<L, R> extends IFunctor<R> {
|
|
166
|
-
value: L | R;
|
|
167
|
-
isLeft(): this is Left<L, R>;
|
|
168
|
-
isRight(): this is Right<L, R>;
|
|
169
|
-
map<U>(f: (value: R) => U): Either<L, U>;
|
|
170
|
-
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
171
|
-
toOption(): Option<R>;
|
|
172
|
-
toList(): List<R>;
|
|
173
|
-
}
|
|
174
|
-
declare class Right<L, R> implements Either<L, R> {
|
|
175
|
-
value: R;
|
|
176
|
-
constructor(value: R);
|
|
177
|
-
isLeft(): this is Left<L, R>;
|
|
178
|
-
isRight(): this is Right<L, R>;
|
|
179
|
-
map<U>(f: (value: R) => U): Either<L, U>;
|
|
180
|
-
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
181
|
-
toOption(): Option<R>;
|
|
182
|
-
toList(): List<R>;
|
|
183
|
-
}
|
|
184
|
-
declare class Left<L, R> implements Either<L, R> {
|
|
185
|
-
value: L;
|
|
186
|
-
constructor(value: L);
|
|
187
|
-
isLeft(): this is Left<L, R>;
|
|
188
|
-
isRight(): this is Right<L, R>;
|
|
189
|
-
map<U>(_f: (value: R) => U): Either<L, U>;
|
|
190
|
-
flatMap<U>(_f: (value: R) => Either<L, U>): Either<L, U>;
|
|
191
|
-
toOption(): Option<R>;
|
|
192
|
-
toList(): List<R>;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
declare const left: <L, R>(value: L) => Either<L, R>;
|
|
196
|
-
declare const right: <L, R>(value: R) => Either<L, R>;
|
|
197
|
-
|
|
198
|
-
interface ITry<T> {
|
|
199
|
-
isSuccess(): boolean;
|
|
200
|
-
isFailure(): boolean;
|
|
201
|
-
getOrElse(defaultValue: T): T;
|
|
202
|
-
orElse(alternative: ITry<T>): ITry<T>;
|
|
203
|
-
toEither(): Either<Error, T>;
|
|
204
|
-
}
|
|
205
|
-
declare class Try<T> implements ITry<T> {
|
|
206
|
-
private readonly value;
|
|
207
|
-
private readonly error;
|
|
208
|
-
private constructor();
|
|
209
|
-
static of<T>(f: () => T): Try<T>;
|
|
210
|
-
isSuccess(): boolean;
|
|
211
|
-
isFailure(): boolean;
|
|
212
|
-
getOrElse(defaultValue: T): T;
|
|
213
|
-
orElse(alternative: ITry<T>): ITry<T>;
|
|
214
|
-
toEither(): Either<Error, T>;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
interface ITraversable<A extends Type> extends IFunctor<A> {
|
|
218
|
-
get size(): number;
|
|
219
|
-
get isEmpty(): boolean;
|
|
220
|
-
contains(value: A): boolean;
|
|
221
|
-
reduce(f: (b: A, a: A) => A): A;
|
|
222
|
-
reduceRight(f: (b: A, a: A) => A): A;
|
|
223
|
-
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
224
|
-
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
export { Either as E, IIterable as I, List as L, Map as M, None as N, Option as O, Right as R, Some as S, Try as T, Seq as a, ISet as b, Set as c, IConverters as d, ICollection as e, IList as f, IMap as g, Left as h, left as i, ITry as j, ITraversable as k, list as l, none as n, option as o, right as r, some as s };
|