functype 0.2.0 → 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-LO5XBCIY.js +1 -0
- package/dist/chunk-OLJYBLCT.js +1 -0
- package/dist/chunk-Q4H3PCBH.mjs +0 -0
- package/dist/chunk-S5YAJ7CP.mjs +1 -0
- package/dist/chunk-SPNWCOGV.mjs +1 -0
- package/dist/chunk-UVR6IELR.mjs +1 -0
- package/dist/chunk-V2J3R5IU.mjs +0 -0
- package/dist/chunk-V5UFW2E4.js +1 -0
- package/dist/chunk-WMSIRQ3W.mjs +1 -0
- package/dist/chunk-XVHCBGUW.js +1 -0
- package/dist/chunk-ZOH672YH.js +1 -0
- package/dist/collections/index.d.mts +2 -4
- package/dist/collections/index.d.ts +2 -4
- package/dist/either/Either.d.mts +3 -0
- package/dist/either/Either.d.ts +3 -0
- package/dist/either/Either.js +1 -0
- package/dist/either/Either.mjs +1 -0
- package/dist/either/index.d.mts +3 -44
- package/dist/either/index.d.ts +3 -44
- 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/functor/index.js +1 -1
- package/dist/functor/index.mjs +1 -0
- package/dist/index-BSx1ncJ9.d.ts +231 -0
- package/dist/index-uP_Hoh2D.d.mts +231 -0
- package/dist/index.d.mts +3 -13
- package/dist/index.d.ts +3 -13
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -0
- package/dist/iterable/Seq.d.mts +2 -28
- package/dist/iterable/Seq.d.ts +2 -28
- package/dist/iterable/Seq.js +1 -1
- package/dist/iterable/Seq.mjs +1 -1
- package/dist/iterable/index.d.mts +2 -2
- package/dist/iterable/index.d.ts +2 -2
- package/dist/iterable/index.js +1 -1
- package/dist/iterable/index.mjs +1 -0
- package/dist/list/List.d.mts +2 -24
- package/dist/list/List.d.ts +2 -24
- package/dist/list/List.js +1 -1
- package/dist/list/List.mjs +1 -1
- package/dist/list/index.d.mts +2 -11
- package/dist/list/index.d.ts +2 -11
- package/dist/list/index.js +1 -1
- package/dist/list/index.mjs +1 -1
- package/dist/map/Map.d.mts +2 -6
- package/dist/map/Map.d.ts +2 -6
- package/dist/map/Map.js +1 -1
- package/dist/map/Map.mjs +1 -1
- package/dist/map/index.d.mts +2 -37
- package/dist/map/index.d.ts +2 -37
- 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 +3 -0
- package/dist/option/Option.d.ts +3 -0
- package/dist/option/Option.js +1 -0
- package/dist/option/Option.mjs +1 -0
- package/dist/option/index.d.mts +2 -8
- package/dist/option/index.d.ts +2 -8
- package/dist/option/index.js +1 -1
- package/dist/option/index.mjs +1 -1
- package/dist/set/Set.d.mts +2 -19
- package/dist/set/Set.d.ts +2 -19
- package/dist/set/Set.js +1 -1
- package/dist/set/Set.mjs +1 -1
- package/dist/set/index.d.mts +2 -4
- package/dist/set/index.d.ts +2 -4
- package/dist/set/index.js +1 -1
- package/dist/set/index.mjs +1 -0
- 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 +2 -29
- package/dist/try/Try.d.ts +2 -29
- package/dist/try/Try.js +1 -1
- package/dist/try/Try.mjs +1 -1
- package/dist/try/index.d.mts +3 -0
- package/dist/try/index.d.ts +3 -0
- package/dist/try/index.js +1 -0
- package/dist/try/index.mjs +1 -0
- package/dist/tuple/Tuple.d.mts +19 -2
- package/dist/tuple/Tuple.d.ts +19 -2
- package/dist/tuple/Tuple.js +1 -1
- package/dist/tuple/Tuple.mjs +1 -1
- package/dist/tuple/index.d.mts +2 -20
- package/dist/tuple/index.d.ts +2 -20
- package/dist/tuple/index.js +1 -1
- package/dist/tuple/index.mjs +1 -1
- package/dist/util/index.d.mts +2 -8
- package/dist/util/index.d.ts +2 -8
- 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-35Y3S46C.js +0 -1
- package/dist/chunk-5OCPRWBH.mjs +0 -1
- package/dist/chunk-5RNU6GKU.mjs +0 -1
- package/dist/chunk-5SPJ52B5.js +0 -1
- package/dist/chunk-5XVNJUCA.js +0 -1
- package/dist/chunk-AGJ7VCYK.mjs +0 -1
- package/dist/chunk-AU3JU6VY.js +0 -1
- package/dist/chunk-FBZLCLTN.mjs +0 -1
- package/dist/chunk-L4P3MMUC.mjs +0 -1
- package/dist/chunk-NBPFHDR5.js +0 -1
- package/dist/chunk-SSP26X5Y.js +0 -1
- package/dist/chunk-V5DD7UJW.mjs +0 -1
- package/dist/chunk-VM6KG6UB.mjs +0 -1
- package/dist/chunk-ZQB7I77M.js +0 -1
- package/dist/either/Left.d.mts +0 -9
- package/dist/either/Left.d.ts +0 -9
- package/dist/either/Left.js +0 -1
- package/dist/either/Left.mjs +0 -1
- package/dist/either/Right.d.mts +0 -9
- package/dist/either/Right.d.ts +0 -9
- package/dist/either/Right.js +0 -1
- package/dist/either/Right.mjs +0 -1
- package/dist/index-18491592.d.ts +0 -33
- package/dist/index-3628fb7a.d.ts +0 -15
- package/dist/index-64357013.d.ts +0 -33
- package/dist/index-8434e22f.d.ts +0 -15
- package/dist/list/IList.d.mts +0 -9
- package/dist/list/IList.d.ts +0 -9
- package/dist/option/IOption.d.mts +0 -3
- package/dist/option/IOption.d.ts +0 -3
- package/dist/option/None.d.mts +0 -21
- package/dist/option/None.d.ts +0 -21
- package/dist/option/None.js +0 -1
- package/dist/option/None.mjs +0 -1
- package/dist/option/Some.d.mts +0 -23
- package/dist/option/Some.d.ts +0 -23
- package/dist/option/Some.js +0 -1
- package/dist/option/Some.mjs +0 -1
- /package/dist/{list/IList.mjs → chunk-3OHJLCSR.mjs} +0 -0
- /package/dist/{list/IList.js → chunk-6BEXQNLZ.js} +0 -0
- /package/dist/{option/IOption.mjs → chunk-74TKYQJS.mjs} +0 -0
- /package/dist/{chunk-VTKL7OQI.js → chunk-D22QKJZO.js} +0 -0
- /package/dist/{chunk-U5EUM74A.mjs → chunk-U37JTC3U.mjs} +0 -0
- /package/dist/{option/IOption.js → chunk-XORABVON.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a=class u{constructor(e){this.values=e}map(e){let r=e(this.values);return new u(r)}flatMap(e){return e(this.values)}get(e){return this.values[e]}getAs(e,r){let t=this.values[e];if(r){if(r(this.values))return t;throw new Error("Cannot cast tuple value")}else return t}toArray(){return this.values}};export{a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkV5UFW2E4js = require('./chunk-V5UFW2E4.js');var _chunk5VTXJIR3js = require('./chunk-5VTXJIR3.js');var _chunkCPB6NX2Sjs = require('./chunk-CPB6NX2S.js');var _chunkLO5XBCIYjs = require('./chunk-LO5XBCIY.js');var _chunkD22QKJZOjs = require('./chunk-D22QKJZO.js');var i=class r{constructor(e){_chunkD22QKJZOjs.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, _chunkV5UFW2E4js.a)([e,t]))}add(e){return new r(this.values.set(e[0],e[1]).entries())}remove(e){let t=new r([...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){return new r(Array.from(this.values.entries()).map(t=>[t[0],e(t[1])]))}flatMap(e){let t=[];for(let[n,V]of this.values.entries()){let l=e(V);if(l instanceof r)for(let[f,m]of l.values.entries())t.push([f,m])}return new r(t)}reduce(e){return new (0, _chunkLO5XBCIYjs.f)(this.entries).reduce(e)}reduceRight(e){return new (0, _chunkLO5XBCIYjs.f)(this.entries).reduceRight(e)}foldLeft(e){let t=new (0, _chunkLO5XBCIYjs.f)(this.entries);return n=>t.foldLeft(e)(n)}foldRight(e){let t=new (0, _chunkLO5XBCIYjs.f)(this.entries);return n=>t.foldRight(e)(n)}get(e){return _chunkLO5XBCIYjs.c.call(void 0, this.values.get(e))}getOrElse(e,t){return _chunkLO5XBCIYjs.c.call(void 0, this.values.get(e)).getOrElse(t)}get isEmpty(){return this.values.size===0}orElse(e,t){let n=_chunkLO5XBCIYjs.c.call(void 0, this.values.get(e));return t}toList(){return new (0, _chunkCPB6NX2Sjs.b)(this.entries)}toSet(){return new (0, _chunkCPB6NX2Sjs.a)(this.entries)}toString(){return`Map(${this.entries.toString()})`}},U=new i([["a",1],["b",2],["c",3]]);exports.a = i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as K}from"./chunk-2XH6TPQK.mjs";import{a as _}from"./chunk-377WQNCB.mjs";import{a as u,b as o}from"./chunk-UVR6IELR.mjs";import{c as a,f as s}from"./chunk-WMSIRQ3W.mjs";import{a as p}from"./chunk-U37JTC3U.mjs";var i=class r{constructor(e){p(this,"values");this.values=new _(e)}get entries(){return Array.from(this.values.entries()).map(([e,t])=>new K([e,t]))}add(e){return new r(this.values.set(e[0],e[1]).entries())}remove(e){let t=new r([...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){return new r(Array.from(this.values.entries()).map(t=>[t[0],e(t[1])]))}flatMap(e){let t=[];for(let[n,V]of this.values.entries()){let l=e(V);if(l instanceof r)for(let[f,m]of l.values.entries())t.push([f,m])}return new r(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 n=>t.foldLeft(e)(n)}foldRight(e){let t=new s(this.entries);return n=>t.foldRight(e)(n)}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 n=a(this.values.get(e));return t}toList(){return new o(this.entries)}toSet(){return new u(this.entries)}toString(){return`Map(${this.entries.toString()})`}},U=new i([["a",1],["b",2],["c",3]]);export{i as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk3VJERXBPjs = require('./chunk-3VJERXBP.js');var _chunkLO5XBCIYjs = require('./chunk-LO5XBCIY.js');var _chunkBNNK42JCjs = require('./chunk-BNNK42JC.js');var o=class e extends _chunkLO5XBCIYjs.f{constructor(t){super(t)}map(t){return new e(super.map(t))}flatMap(t){return new e(super.flatMap(t))}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 _chunkLO5XBCIYjs.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 w=e=>new o(e);var n=class e extends _chunkLO5XBCIYjs.f{constructor(t){_chunkBNNK42JCjs.a.call(void 0, t)?super(new (0, _chunk3VJERXBPjs.a)(t)):super(_optionalChain([t, 'optionalAccess', _ => _.toArray, 'call', _2 => _2()]))}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))}flatMap(t){return new e(super.flatMap(t))}toList(){return new o(this)}toSet(){return this}toString(){return`Set(${this.toArray().toString()})`}};exports.a = n; exports.b = o; exports.c = w;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,b as r}from"./chunk-S5YAJ7CP.mjs";var o=t=>new r(t),i=t=>new e(t);export{o as a,i as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkCPB6NX2Sjs = require('./chunk-CPB6NX2S.js');var _chunkLO5XBCIYjs = require('./chunk-LO5XBCIY.js');var u=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 _chunkLO5XBCIYjs.d.call(void 0, this.value)}toList(){return new (0, _chunkCPB6NX2Sjs.b)([this.value])}},n= 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 _chunkLO5XBCIYjs.e.call(void 0, )}toList(){return new _chunkCPB6NX2Sjs.b}};exports.a = u; exports.b = n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHF33BEHOjs = require('./chunk-HF33BEHO.js');var o=t=>new (0, _chunkHF33BEHOjs.b)(t),i= exports.b =t=>new (0, _chunkHF33BEHOjs.a)(t);exports.a = o; exports.b = i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBNNK42JCjs = require('./chunk-BNNK42JC.js');var _chunkD22QKJZOjs = require('./chunk-D22QKJZO.js');var s=t=>t?_(t):l(),_= exports.d =t=>new o(t),l= exports.e =()=>new i;var n=class t{constructor(e){_chunkD22QKJZOjs.a.call(void 0, this,"values");_chunkBNNK42JCjs.a.call(void 0, e)?this.values=e:e instanceof t?this.values=e.toArray():e||(this.values=[])}get length(){return this.toArray().length}map(e){return new t(this.toArray().map(e))}flatMap(e){let r=[];for(let u of this.values){let a=e(u);a instanceof t&&r.push(...a.values)}return new t(r)}forEach(e){this.toArray().forEach(e)}count(e){return 0}exists(e){return!this.find(e).isEmpty}filter(e){return new t(this.toArray().filter(e))}filterNot(e){return new t(this.toArray().filter(r=>!e(r)))}find(e){let r=this.toArray().find(e);return s(r)}get head(){return this.values[0]}get headOption(){return this.isEmpty?s(this.head):l()}get isEmpty(){return this.toArray().length===0}get size(){return 0}toArray(){return Array.from(this.values)}reduce(e){return this.toArray().reduce(e)}reduceRight(e){return this.toArray().reduceRight(e)}foldLeft(e){return r=>this.toArray().reduce(r,e)}foldRight(e){return r=>this.toArray().reduceRight((u,a)=>r(a,u),e)}};var o=class t{constructor(e){this.value=e}get isEmpty(){return!1}get(){return this.value}getOrElse(e){return this.value}orElse(e){return this}map(e){return new t(e(this.value))}flatMap(e){return e(this.value)}reduce(e){return e(void 0,this.value)}reduceRight(e){return e(void 0,this.value)}foldLeft(e){return r=>r(e,this.value)}foldRight(e){return r=>r(this.value,e)}toList(){return new n([this.value])}contains(e){return!1}get size(){return 0}},i= exports.b =class t{get isEmpty(){return!0}get(){throw new Error("Cannot call get() on a None")}getOrElse(e){return e}orElse(e){return e}map(e){return new t}flatMap(e){return new t}reduce(e){return e(void 0,void 0)}reduceRight(e){return e(void 0,void 0)}foldLeft(e){return r=>e}foldRight(e){return r=>e}toList(){return new n}contains(e){return!1}get size(){return 0}};exports.a = o; exports.b = i; exports.c = s; exports.d = _; exports.e = l; exports.f = n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHF33BEHOjs = require('./chunk-HF33BEHO.js');var i=class t{constructor(r,e){this.value=r;this.error=e}static of(r){try{return new t(r(),null)}catch(e){return new t(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, _chunkHF33BEHOjs.a)(this.value):new (0, _chunkHF33BEHOjs.b)(this.error)}};exports.a = i;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as i}from"./chunk-UVR6IELR.mjs";import{d as r,e as s}from"./chunk-WMSIRQ3W.mjs";var u=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 r(this.value)}toList(){return new i([this.value])}},n=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 s()}toList(){return new i}};export{u as a,n as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as s,b as o}from"./chunk-S5YAJ7CP.mjs";var i=class t{constructor(r,e){this.value=r;this.error=e}static of(r){try{return new t(r(),null)}catch(e){return new t(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 s(this.value):new o(this.error)}};export{i as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-HA5XD5KC.mjs";import{c as A,f as s}from"./chunk-WMSIRQ3W.mjs";import{a as m}from"./chunk-RRAIFS3D.mjs";var o=class e extends s{constructor(t){super(t)}map(t){return new e(super.map(t))}flatMap(t){return new e(super.flatMap(t))}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 w=e=>new o(e);var n=class e extends s{constructor(t){m(t)?super(new a(t)):super(t?.toArray())}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))}flatMap(t){return new e(super.flatMap(t))}toList(){return new o(this)}toSet(){return this}toString(){return`Set(${this.toArray().toString()})`}};export{n as a,o as b,w as c};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var a=class u{constructor(e){this.values=e}map(e){let r=e(this.values);return new u(r)}flatMap(e){return e(this.values)}get(e){return this.values[e]}getAs(e,r){let t=this.values[e];if(r){if(r(this.values))return t;throw new Error("Cannot cast tuple value")}else return t}toArray(){return this.values}};exports.a = a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as A}from"./chunk-RRAIFS3D.mjs";import{a as p}from"./chunk-U37JTC3U.mjs";var s=t=>t?_(t):l(),_=t=>new o(t),l=()=>new i;var n=class t{constructor(e){p(this,"values");A(e)?this.values=e:e instanceof t?this.values=e.toArray():e||(this.values=[])}get length(){return this.toArray().length}map(e){return new t(this.toArray().map(e))}flatMap(e){let r=[];for(let u of this.values){let a=e(u);a instanceof t&&r.push(...a.values)}return new t(r)}forEach(e){this.toArray().forEach(e)}count(e){return 0}exists(e){return!this.find(e).isEmpty}filter(e){return new t(this.toArray().filter(e))}filterNot(e){return new t(this.toArray().filter(r=>!e(r)))}find(e){let r=this.toArray().find(e);return s(r)}get head(){return this.values[0]}get headOption(){return this.isEmpty?s(this.head):l()}get isEmpty(){return this.toArray().length===0}get size(){return 0}toArray(){return Array.from(this.values)}reduce(e){return this.toArray().reduce(e)}reduceRight(e){return this.toArray().reduceRight(e)}foldLeft(e){return r=>this.toArray().reduce(r,e)}foldRight(e){return r=>this.toArray().reduceRight((u,a)=>r(a,u),e)}};var o=class t{constructor(e){this.value=e}get isEmpty(){return!1}get(){return this.value}getOrElse(e){return this.value}orElse(e){return this}map(e){return new t(e(this.value))}flatMap(e){return e(this.value)}reduce(e){return e(void 0,this.value)}reduceRight(e){return e(void 0,this.value)}foldLeft(e){return r=>r(e,this.value)}foldRight(e){return r=>r(this.value,e)}toList(){return new n([this.value])}contains(e){return!1}get size(){return 0}},i=class t{get isEmpty(){return!0}get(){throw new Error("Cannot call get() on a None")}getOrElse(e){return e}orElse(e){return e}map(e){return new t}flatMap(e){return new t}reduce(e){return e(void 0,void 0)}reduceRight(e){return e(void 0,void 0)}foldLeft(e){return r=>e}foldRight(e){return r=>e}toList(){return new n}contains(e){return!1}get size(){return 0}};export{o as a,i as b,s as c,_ as d,l as e,n as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import '../list/IList.mjs';
|
|
3
|
-
import '../index-18491592.js';
|
|
1
|
+
export { I as IConverters, e as _Collection } from '../index-uP_Hoh2D.mjs';
|
|
4
2
|
import '../functor/index.mjs';
|
|
5
|
-
import '../
|
|
3
|
+
import '../tuple/Tuple.mjs';
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import '../list/IList.js';
|
|
3
|
-
import '../index-64357013.js';
|
|
1
|
+
export { I as IConverters, e as _Collection } from '../index-BSx1ncJ9.js';
|
|
4
2
|
import '../functor/index.js';
|
|
5
|
-
import '../
|
|
3
|
+
import '../tuple/Tuple.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHF33BEHOjs = require('../chunk-HF33BEHO.js');require('../chunk-CPB6NX2S.js');require('../chunk-3VJERXBP.js');require('../chunk-XVHCBGUW.js');require('../chunk-LO5XBCIY.js');require('../chunk-BNNK42JC.js');require('../chunk-D22QKJZO.js');exports.Left = _chunkHF33BEHOjs.b; exports.Right = _chunkHF33BEHOjs.a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"../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{b as Left,a as Right};
|
package/dist/either/index.d.mts
CHANGED
|
@@ -1,44 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import '../iterable/Seq.mjs';
|
|
5
|
-
import '../index-3628fb7a.js';
|
|
6
|
-
import '../list/IList.mjs';
|
|
7
|
-
import '../set/Set.mjs';
|
|
8
|
-
import '../index.mjs';
|
|
9
|
-
|
|
10
|
-
declare class Left<L, R> implements Either<L, R> {
|
|
11
|
-
value: L;
|
|
12
|
-
constructor(value: L);
|
|
13
|
-
isLeft(): this is Left<L, R>;
|
|
14
|
-
isRight(): this is Right<L, R>;
|
|
15
|
-
map<U>(_f: (value: R) => U): Either<L, U>;
|
|
16
|
-
flatMap<U>(_f: (value: R) => Either<L, U>): Either<L, U>;
|
|
17
|
-
toOption(): IOption<R>;
|
|
18
|
-
toList(): List<R>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
declare class Right<L, R> implements Either<L, R> {
|
|
22
|
-
value: R;
|
|
23
|
-
constructor(value: R);
|
|
24
|
-
isLeft(): this is Left<L, R>;
|
|
25
|
-
isRight(): this is Right<L, R>;
|
|
26
|
-
map<U>(f: (value: R) => U): Either<L, U>;
|
|
27
|
-
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
28
|
-
toOption(): IOption<R>;
|
|
29
|
-
toList(): List<R>;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
interface Either<L, R> extends IFunctor<R> {
|
|
33
|
-
value: L | R;
|
|
34
|
-
isLeft(): this is Left<L, R>;
|
|
35
|
-
isRight(): this is Right<L, R>;
|
|
36
|
-
map<U>(f: (value: R) => U): Either<L, U>;
|
|
37
|
-
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
38
|
-
toOption(): IOption<R>;
|
|
39
|
-
toList(): List<R>;
|
|
40
|
-
}
|
|
41
|
-
declare const left: <L, R>(value: L) => Either<L, R>;
|
|
42
|
-
declare const right: <L, R>(value: R) => Either<L, R>;
|
|
43
|
-
|
|
44
|
-
export { Either, Left, Right, left, right };
|
|
1
|
+
export { E as Either, h as Left, R as Right, i as left, r as right } from '../index-uP_Hoh2D.mjs';
|
|
2
|
+
import '../functor/index.mjs';
|
|
3
|
+
import '../tuple/Tuple.mjs';
|
package/dist/either/index.d.ts
CHANGED
|
@@ -1,44 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import '../iterable/Seq.js';
|
|
5
|
-
import '../index-8434e22f.js';
|
|
6
|
-
import '../list/IList.js';
|
|
7
|
-
import '../set/Set.js';
|
|
8
|
-
import '../index.js';
|
|
9
|
-
|
|
10
|
-
declare class Left<L, R> implements Either<L, R> {
|
|
11
|
-
value: L;
|
|
12
|
-
constructor(value: L);
|
|
13
|
-
isLeft(): this is Left<L, R>;
|
|
14
|
-
isRight(): this is Right<L, R>;
|
|
15
|
-
map<U>(_f: (value: R) => U): Either<L, U>;
|
|
16
|
-
flatMap<U>(_f: (value: R) => Either<L, U>): Either<L, U>;
|
|
17
|
-
toOption(): IOption<R>;
|
|
18
|
-
toList(): List<R>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
declare class Right<L, R> implements Either<L, R> {
|
|
22
|
-
value: R;
|
|
23
|
-
constructor(value: R);
|
|
24
|
-
isLeft(): this is Left<L, R>;
|
|
25
|
-
isRight(): this is Right<L, R>;
|
|
26
|
-
map<U>(f: (value: R) => U): Either<L, U>;
|
|
27
|
-
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
28
|
-
toOption(): IOption<R>;
|
|
29
|
-
toList(): List<R>;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
interface Either<L, R> extends IFunctor<R> {
|
|
33
|
-
value: L | R;
|
|
34
|
-
isLeft(): this is Left<L, R>;
|
|
35
|
-
isRight(): this is Right<L, R>;
|
|
36
|
-
map<U>(f: (value: R) => U): Either<L, U>;
|
|
37
|
-
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
38
|
-
toOption(): IOption<R>;
|
|
39
|
-
toList(): List<R>;
|
|
40
|
-
}
|
|
41
|
-
declare const left: <L, R>(value: L) => Either<L, R>;
|
|
42
|
-
declare const right: <L, R>(value: R) => Either<L, R>;
|
|
43
|
-
|
|
44
|
-
export { Either, Left, Right, left, right };
|
|
1
|
+
export { E as Either, h as Left, R as Right, i as left, r as right } from '../index-BSx1ncJ9.js';
|
|
2
|
+
import '../functor/index.js';
|
|
3
|
+
import '../tuple/Tuple.js';
|
package/dist/either/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');var _chunkHF33BEHOjs = require('../chunk-HF33BEHO.js');require('../chunk-CPB6NX2S.js');require('../chunk-3VJERXBP.js');require('../chunk-XVHCBGUW.js');require('../chunk-LO5XBCIY.js');require('../chunk-BNNK42JC.js');require('../chunk-D22QKJZO.js');exports.Left = _chunkHF33BEHOjs.b; exports.Right = _chunkHF33BEHOjs.a; exports.left = _chunkLLZGG3YTjs.a; exports.right = _chunkLLZGG3YTjs.b;
|
package/dist/either/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c,b as d}from"../chunk-
|
|
1
|
+
import{a as c,b as d}from"../chunk-GZIDEEAG.mjs";import{a,b}from"../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{b as Left,a as Right,c as left,d as right};
|
package/dist/error/ParseError.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZTL76QDLjs = require('../chunk-ZTL76QDL.js');require('../chunk-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZTL76QDLjs = require('../chunk-ZTL76QDL.js');require('../chunk-D22QKJZO.js');exports.ParseError = _chunkZTL76QDLjs.a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-CFYIJKWF.mjs";import"../chunk-
|
|
1
|
+
import{a}from"../chunk-CFYIJKWF.mjs";import"../chunk-U37JTC3U.mjs";export{a as ParseError};
|
package/dist/functor/index.d.mts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
type SingleType = any;
|
|
2
2
|
type ArrayType = SingleType[];
|
|
3
3
|
type Type = SingleType | ArrayType;
|
|
4
|
-
|
|
5
|
-
map(f: (value: A) => Type):
|
|
6
|
-
flatMap(f: (value: A) =>
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
map<B extends Type>(f: (value: A) => B):
|
|
10
|
-
flatMap<B extends Type>(f: (value: A) =>
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
map<U extends ArrayType>(f: (value: A) => U):
|
|
14
|
-
flatMap<U extends ArrayType>(f: (value: A) =>
|
|
15
|
-
}
|
|
4
|
+
type _AbstractFunctor_<A extends Type> = {
|
|
5
|
+
map(f: (value: A) => Type): _AbstractFunctor_<Type>;
|
|
6
|
+
flatMap(f: (value: A) => _AbstractFunctor_<Type>): _AbstractFunctor_<Type>;
|
|
7
|
+
};
|
|
8
|
+
type _Functor_<A extends Type> = _AbstractFunctor_<A> & {
|
|
9
|
+
map<B extends Type>(f: (value: A) => B): _Functor_<B>;
|
|
10
|
+
flatMap<B extends Type>(f: (value: A) => _Functor_<B>): _Functor_<B>;
|
|
11
|
+
};
|
|
12
|
+
type _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
|
+
};
|
|
16
16
|
|
|
17
|
-
export { ArrayType,
|
|
17
|
+
export type { ArrayType, SingleType, Type, _AbstractFunctor_, _ArrayFunctor_, _Functor_ };
|
package/dist/functor/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
type SingleType = any;
|
|
2
2
|
type ArrayType = SingleType[];
|
|
3
3
|
type Type = SingleType | ArrayType;
|
|
4
|
-
|
|
5
|
-
map(f: (value: A) => Type):
|
|
6
|
-
flatMap(f: (value: A) =>
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
map<B extends Type>(f: (value: A) => B):
|
|
10
|
-
flatMap<B extends Type>(f: (value: A) =>
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
map<U extends ArrayType>(f: (value: A) => U):
|
|
14
|
-
flatMap<U extends ArrayType>(f: (value: A) =>
|
|
15
|
-
}
|
|
4
|
+
type _AbstractFunctor_<A extends Type> = {
|
|
5
|
+
map(f: (value: A) => Type): _AbstractFunctor_<Type>;
|
|
6
|
+
flatMap(f: (value: A) => _AbstractFunctor_<Type>): _AbstractFunctor_<Type>;
|
|
7
|
+
};
|
|
8
|
+
type _Functor_<A extends Type> = _AbstractFunctor_<A> & {
|
|
9
|
+
map<B extends Type>(f: (value: A) => B): _Functor_<B>;
|
|
10
|
+
flatMap<B extends Type>(f: (value: A) => _Functor_<B>): _Functor_<B>;
|
|
11
|
+
};
|
|
12
|
+
type _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
|
+
};
|
|
16
16
|
|
|
17
|
-
export { ArrayType,
|
|
17
|
+
export type { ArrayType, SingleType, Type, _AbstractFunctor_, _ArrayFunctor_, _Functor_ };
|
package/dist/functor/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";require('../chunk-XORABVON.js');
|
package/dist/functor/index.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../chunk-V2J3R5IU.mjs";
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { Type, _Functor_ } from './functor/index.js';
|
|
2
|
+
import { _Tuple_, Tuple } from './tuple/Tuple.js';
|
|
3
|
+
|
|
4
|
+
type _Option_<T extends Type> = {
|
|
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(): _Iterable_<T>;
|
|
11
|
+
valueOf(): Object;
|
|
12
|
+
} & _Traversable_<T> & _Functor_<T>;
|
|
13
|
+
declare class Some<A extends Type> implements _Option_<A> {
|
|
14
|
+
private value;
|
|
15
|
+
constructor(value: A);
|
|
16
|
+
get isEmpty(): boolean;
|
|
17
|
+
get(): A;
|
|
18
|
+
getOrElse(defaultValue: A): A;
|
|
19
|
+
orElse(alternative: _Option_<A>): _Option_<A>;
|
|
20
|
+
map<U extends Type>(f: (value: A) => U): _Option_<U>;
|
|
21
|
+
flatMap<U extends Type>(f: (value: A) => _Option_<U>): _Option_<U>;
|
|
22
|
+
reduce<U>(f: (acc: U, value: A) => U): U;
|
|
23
|
+
reduceRight<U>(f: (acc: U, value: A) => U): U;
|
|
24
|
+
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
25
|
+
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
26
|
+
toList(): _Iterable_<A>;
|
|
27
|
+
contains(value: A): boolean;
|
|
28
|
+
get size(): number;
|
|
29
|
+
}
|
|
30
|
+
declare class None<A extends Type> implements _Option_<A> {
|
|
31
|
+
get isEmpty(): boolean;
|
|
32
|
+
get(): A;
|
|
33
|
+
getOrElse(defaultValue: A): A;
|
|
34
|
+
orElse(alternative: _Option_<A>): _Option_<A>;
|
|
35
|
+
map<U extends Type>(f: (value: A) => U): _Option_<U>;
|
|
36
|
+
flatMap<U extends Type>(f: (value: A) => _Option_<U>): _Option_<U>;
|
|
37
|
+
reduce(f: (acc: A, value: A) => A): A;
|
|
38
|
+
reduceRight(f: (b: A, a: A) => A): A;
|
|
39
|
+
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
40
|
+
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
41
|
+
toList(): _Iterable_<A>;
|
|
42
|
+
contains(value: A): boolean;
|
|
43
|
+
get size(): number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
declare const option: <T extends unknown>(value?: T) => _Option_<T>;
|
|
47
|
+
declare const some: <T extends unknown>(value: T) => _Option_<T>;
|
|
48
|
+
declare const none: <T extends unknown>() => _Option_<T>;
|
|
49
|
+
|
|
50
|
+
declare class Seq<A> implements _Iterable_<A> {
|
|
51
|
+
protected readonly values: Iterable<A>;
|
|
52
|
+
constructor(values?: Iterable<A> | _Iterable_<A>);
|
|
53
|
+
readonly [n: number]: A;
|
|
54
|
+
get length(): number;
|
|
55
|
+
map<B>(f: (a: A) => B): _Iterable_<B>;
|
|
56
|
+
flatMap<B>(f: (a: A) => _Iterable_<B>): _Iterable_<B>;
|
|
57
|
+
forEach(f: (a: A) => void): void;
|
|
58
|
+
count(p: (x: A) => boolean): number;
|
|
59
|
+
exists(p: (a: A) => boolean): Boolean;
|
|
60
|
+
filter(p: (a: A) => boolean): _Iterable_<A>;
|
|
61
|
+
filterNot(p: (a: A) => boolean): _Iterable_<A>;
|
|
62
|
+
find(p: (a: A) => boolean): _Option_<A>;
|
|
63
|
+
get head(): A;
|
|
64
|
+
get headOption(): _Option_<A>;
|
|
65
|
+
get isEmpty(): boolean;
|
|
66
|
+
get size(): number;
|
|
67
|
+
toArray(): A[];
|
|
68
|
+
reduce(f: (prev: A, curr: A) => A): A;
|
|
69
|
+
reduceRight(f: (prev: A, curr: A) => A): A;
|
|
70
|
+
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
71
|
+
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
type _Iterable_<A extends Type> = {
|
|
75
|
+
count(p: (x: A) => boolean): number;
|
|
76
|
+
find(p: (a: A) => boolean): _Option_<A>;
|
|
77
|
+
forEach(f: (a: A) => void): void;
|
|
78
|
+
exists(p: (a: A) => boolean): Boolean;
|
|
79
|
+
filter(p: (a: A) => boolean): _Iterable_<A>;
|
|
80
|
+
filterNot(p: (a: A) => boolean): _Iterable_<A>;
|
|
81
|
+
reduce(f: (b: A, a: A) => A): A;
|
|
82
|
+
reduceRight(f: (b: A, a: A) => A): A;
|
|
83
|
+
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
84
|
+
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
85
|
+
get head(): A;
|
|
86
|
+
get headOption(): _Option_<A>;
|
|
87
|
+
get isEmpty(): boolean;
|
|
88
|
+
map<B extends Type>(f: (a: A) => B): _Iterable_<B>;
|
|
89
|
+
flatMap<B extends Type>(f: (a: A) => _Iterable_<B>): _Iterable_<B>;
|
|
90
|
+
get size(): number;
|
|
91
|
+
toArray(): readonly A[];
|
|
92
|
+
} & _Functor_<A>;
|
|
93
|
+
|
|
94
|
+
type _Set_<T> = {
|
|
95
|
+
has(value: T): boolean;
|
|
96
|
+
} & _Iterable_<T> & _Collection<T>;
|
|
97
|
+
declare class Set<A> extends Seq<A> implements _Set_<A> {
|
|
98
|
+
constructor(iterable?: Iterable<A> | _Iterable_<A>);
|
|
99
|
+
add(value: A): Set<A>;
|
|
100
|
+
remove(value: A): Set<A>;
|
|
101
|
+
contains(value: A): boolean;
|
|
102
|
+
has(value: A): boolean;
|
|
103
|
+
map<B>(f: (a: A) => B): Set<B>;
|
|
104
|
+
flatMap<B>(f: (a: A) => _Iterable_<B>): Set<B>;
|
|
105
|
+
toList(): _List_<A>;
|
|
106
|
+
toSet(): _Set_<A>;
|
|
107
|
+
toString(): string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
type IConverters<A> = {
|
|
111
|
+
toList(): _List_<A>;
|
|
112
|
+
toSet(): _Set_<A>;
|
|
113
|
+
toString(): string;
|
|
114
|
+
};
|
|
115
|
+
type _Collection<A> = IConverters<A>;
|
|
116
|
+
|
|
117
|
+
interface _List_<T> extends _Iterable_<T>, ArrayLike<T> {
|
|
118
|
+
add(item: T): _List_<T>;
|
|
119
|
+
}
|
|
120
|
+
declare class List<A> extends Seq<A> implements _List_<A>, _Collection<A> {
|
|
121
|
+
constructor(values?: Iterable<A> | _Iterable_<A>);
|
|
122
|
+
readonly [n: number]: A;
|
|
123
|
+
map<B>(f: (a: A) => B): List<B>;
|
|
124
|
+
flatMap<B>(f: (a: A) => _Iterable_<B>): List<B>;
|
|
125
|
+
remove(value: A): List<A>;
|
|
126
|
+
contains(value: A): boolean;
|
|
127
|
+
add(item: A): List<A>;
|
|
128
|
+
removeAt(index: number): List<A>;
|
|
129
|
+
get(index: number): _Option_<A>;
|
|
130
|
+
concat(other: List<A>): List<A>;
|
|
131
|
+
toList(): _List_<A>;
|
|
132
|
+
toSet(): Set<A>;
|
|
133
|
+
toString(): string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
declare const list: <T extends unknown>(items: T[] | undefined) => List<T>;
|
|
137
|
+
|
|
138
|
+
type SafeTraversable<K, V> = Omit<_Traversable_<_Tuple_<[K, V]>>, "map" | "flatMap">;
|
|
139
|
+
type _Map_<K, V> = {
|
|
140
|
+
map<U>(f: (value: any) => U): _Map_<K, U>;
|
|
141
|
+
flatMap<U>(f: (value: any) => _Map_<K, U>): _Map_<K, U>;
|
|
142
|
+
get(key: K): _Option_<V>;
|
|
143
|
+
getOrElse(key: K, defaultValue: V): V;
|
|
144
|
+
orElse(key: K, alternative: _Option_<V>): _Option_<V>;
|
|
145
|
+
} & SafeTraversable<K, V> & _Collection<_Tuple_<[K, V]>>;
|
|
146
|
+
declare class Map<K, V> implements _Map_<K, V> {
|
|
147
|
+
private values;
|
|
148
|
+
private get entries();
|
|
149
|
+
constructor(entries?: readonly (readonly [K, V])[] | IterableIterator<[K, V]> | null);
|
|
150
|
+
add(item: _Tuple_<[K, V]>): Map<K, V>;
|
|
151
|
+
remove(value: _Tuple_<[K, V]>): Map<K, V>;
|
|
152
|
+
contains(value: _Tuple_<[K, V]>): boolean;
|
|
153
|
+
get size(): number;
|
|
154
|
+
map<U>(f: (value: V) => U): _Map_<K, U>;
|
|
155
|
+
flatMap<U>(f: (value: V) => _Map_<K, U>): _Map_<K, U>;
|
|
156
|
+
reduce(f: (acc: Tuple<[K, V]>, value: Tuple<[K, V]>) => Tuple<[K, V]>): Tuple<[K, V]>;
|
|
157
|
+
reduceRight(f: (acc: Tuple<[K, V]>, value: Tuple<[K, V]>) => Tuple<[K, V]>): Tuple<[K, V]>;
|
|
158
|
+
foldLeft<B>(z: B): (op: (b: B, a: _Tuple_<[K, V]>) => B) => B;
|
|
159
|
+
foldRight<B>(z: B): (op: (a: _Tuple_<[K, V]>, b: B) => B) => B;
|
|
160
|
+
get(key: K): _Option_<V>;
|
|
161
|
+
getOrElse(key: K, defaultValue: V): V;
|
|
162
|
+
get isEmpty(): boolean;
|
|
163
|
+
orElse(key: K, alternative: _Option_<V>): _Option_<V>;
|
|
164
|
+
toList(): _List_<Tuple<[K, V]>>;
|
|
165
|
+
toSet(): _Set_<Tuple<[K, V]>>;
|
|
166
|
+
toString(): string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
type Either<L, R> = {
|
|
170
|
+
value: L | R;
|
|
171
|
+
isLeft(): boolean;
|
|
172
|
+
isRight(): boolean;
|
|
173
|
+
map<U>(f: (value: R) => U): Either<L, U>;
|
|
174
|
+
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
175
|
+
toOption(): _Option_<R>;
|
|
176
|
+
toList(): List<R>;
|
|
177
|
+
} & _Functor_<R>;
|
|
178
|
+
declare class Right<L, R> implements Either<L, R> {
|
|
179
|
+
value: R;
|
|
180
|
+
constructor(value: R);
|
|
181
|
+
isLeft(): this is Left<L, R>;
|
|
182
|
+
isRight(): this is Right<L, R>;
|
|
183
|
+
map<U>(f: (value: R) => U): Either<L, U>;
|
|
184
|
+
flatMap<U>(f: (value: R) => Either<L, U>): Either<L, U>;
|
|
185
|
+
toOption(): _Option_<R>;
|
|
186
|
+
toList(): List<R>;
|
|
187
|
+
}
|
|
188
|
+
declare class Left<L, R> implements Either<L, R> {
|
|
189
|
+
value: L;
|
|
190
|
+
constructor(value: L);
|
|
191
|
+
isLeft(): this is Left<L, R>;
|
|
192
|
+
isRight(): this is Right<L, R>;
|
|
193
|
+
map<U>(_f: (value: R) => U): Either<L, U>;
|
|
194
|
+
flatMap<U>(_f: (value: R) => Either<L, U>): Either<L, U>;
|
|
195
|
+
toOption(): _Option_<R>;
|
|
196
|
+
toList(): List<R>;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
declare const left: <L, R>(value: L) => Either<L, R>;
|
|
200
|
+
declare const right: <L, R>(value: R) => Either<L, R>;
|
|
201
|
+
|
|
202
|
+
type _Try_<T> = {
|
|
203
|
+
isSuccess(): boolean;
|
|
204
|
+
isFailure(): boolean;
|
|
205
|
+
getOrElse(defaultValue: T): T;
|
|
206
|
+
orElse(alternative: _Try_<T>): _Try_<T>;
|
|
207
|
+
toEither(): Either<Error, T>;
|
|
208
|
+
};
|
|
209
|
+
declare class Try<T> implements _Try_<T> {
|
|
210
|
+
private readonly value;
|
|
211
|
+
private readonly error;
|
|
212
|
+
private constructor();
|
|
213
|
+
static of<T>(f: () => T): _Try_<T>;
|
|
214
|
+
isSuccess(): boolean;
|
|
215
|
+
isFailure(): boolean;
|
|
216
|
+
getOrElse(defaultValue: T): T;
|
|
217
|
+
orElse(alternative: _Try_<T>): _Try_<T>;
|
|
218
|
+
toEither(): Either<Error, T>;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
type _Traversable_<A extends Type> = _Functor_<A> & {
|
|
222
|
+
get size(): number;
|
|
223
|
+
get isEmpty(): boolean;
|
|
224
|
+
contains(value: A): boolean;
|
|
225
|
+
reduce(f: (b: A, a: A) => A): A;
|
|
226
|
+
reduceRight(f: (b: A, a: A) => A): A;
|
|
227
|
+
foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
|
|
228
|
+
foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export { type Either as E, type IConverters as I, List as L, Map as M, None as N, Right as R, Some as S, Try as T, type _Option_ as _, Seq as a, type _Iterable_ as b, type _Set_ as c, Set as d, type _Collection as e, type _List_ as f, type _Map_ as g, Left as h, left as i, type _Try_ as j, type _Traversable_ as k, list as l, none as n, option as o, right as r, some as s };
|