functype 0.0.3 → 0.0.5
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/either/Left.d.cts +2 -1
- package/dist/either/Left.d.ts +2 -1
- package/dist/either/Right.d.cts +2 -1
- package/dist/either/Right.d.ts +2 -1
- package/dist/either/index.cjs +1 -1
- package/dist/either/index.d.cts +2 -1
- package/dist/either/index.d.ts +2 -1
- package/dist/either/index.js +1 -1
- package/dist/{index-92d6660e.d.ts → index-28de5927.d.ts} +2 -26
- package/dist/{index-7c5c3a08.d.ts → index-402b9aa2.d.ts} +2 -26
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +0 -1
- package/dist/list/List.cjs +1 -1
- package/dist/list/List.d.cts +20 -2
- package/dist/list/List.d.ts +20 -2
- package/dist/list/List.js +1 -1
- package/package.json +7 -8
- package/dist/chunk-E4GBAXJ4.js +0 -1
- package/dist/chunk-HWJMIJH6.cjs +0 -1
- package/dist/chunk-PXY4XULG.cjs +0 -1
- package/dist/chunk-QK5JVYJ3.js +0 -1
package/dist/either/Left.d.cts
CHANGED
package/dist/either/Left.d.ts
CHANGED
package/dist/either/Right.d.cts
CHANGED
package/dist/either/Right.d.ts
CHANGED
package/dist/either/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk4EVP3IRIcjs = require('../chunk-4EVP3IRI.cjs');var _chunkCB3ZZ3RLcjs = require('../chunk-CB3ZZ3RL.cjs');var _chunk6VKVA3TKcjs = require('../chunk-6VKVA3TK.cjs');require('../chunk-GWLTG6GZ.cjs');var s=r=>new (0, _chunk4EVP3IRIcjs.a)(r),n= exports.right =r=>new (0, _chunkCB3ZZ3RLcjs.a)(r),h= exports.parseNumber =r=>{let t=parseInt(r,10);return isNaN(t)?s(new (0, _chunk6VKVA3TKcjs.a)(`${t}`)):n(t)};exports.left = s; exports.parseNumber = h; exports.right = n;
|
package/dist/either/index.d.cts
CHANGED
package/dist/either/index.d.ts
CHANGED
package/dist/either/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import{a as i}from"../chunk-ABUN2GHU.js";import{a as o}from"../chunk-CN6MP6AJ.js";import{a as e}from"../chunk-ZTL76QDL.js";import"../chunk-VTKL7OQI.js";var s=r=>new i(r),n=r=>new o(r),h=r=>{let t=parseInt(r,10);return isNaN(t)?s(new e(`${t}`)):n(t)};export{s as left,h as parseNumber,n as right};
|
|
@@ -1,21 +1,5 @@
|
|
|
1
1
|
import { ParseError } from './error/ParseError.js';
|
|
2
|
-
|
|
3
|
-
declare class List<T> implements IFunctor<T> {
|
|
4
|
-
private readonly items;
|
|
5
|
-
constructor(items?: T[]);
|
|
6
|
-
get length(): number;
|
|
7
|
-
add(item: T): List<T>;
|
|
8
|
-
removeAt(index: number): List<T>;
|
|
9
|
-
get(index: number): T | undefined;
|
|
10
|
-
toArray(): readonly T[];
|
|
11
|
-
map<U>(f: (value: T) => U): List<U>;
|
|
12
|
-
flatMap<U>(f: (value: T) => List<U>): List<U>;
|
|
13
|
-
reduce<U>(f: (acc: U, value: T) => U): List<U>;
|
|
14
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
15
|
-
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
16
|
-
concat(other: List<T>): List<T>;
|
|
17
|
-
toString(): string;
|
|
18
|
-
}
|
|
2
|
+
import { IFunctor } from './index.js';
|
|
19
3
|
|
|
20
4
|
declare class Right<L, R> implements Either<L, R> {
|
|
21
5
|
value: R;
|
|
@@ -52,12 +36,4 @@ declare const left: <L, R>(value: L) => Either<L, R>;
|
|
|
52
36
|
declare const right: <L, R>(value: R) => Either<L, R>;
|
|
53
37
|
declare const parseNumber: (input: string) => Either<ParseError, number>;
|
|
54
38
|
|
|
55
|
-
|
|
56
|
-
map<U>(f: (value: T) => U): IFunctor<U>;
|
|
57
|
-
flatMap<U>(f: (value: T) => IFunctor<U>): IFunctor<U>;
|
|
58
|
-
reduce<U>(f: (acc: U, value: T) => U): IFunctor<U>;
|
|
59
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
60
|
-
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export { Either as E, IFunctor as I, List as L, Right as R, Left as a, left as l, parseNumber as p, right as r };
|
|
39
|
+
export { Either as E, Left as L, Right as R, left as l, parseNumber as p, right as r };
|
|
@@ -1,21 +1,5 @@
|
|
|
1
1
|
import { ParseError } from './error/ParseError.cjs';
|
|
2
|
-
|
|
3
|
-
declare class List<T> implements IFunctor<T> {
|
|
4
|
-
private readonly items;
|
|
5
|
-
constructor(items?: T[]);
|
|
6
|
-
get length(): number;
|
|
7
|
-
add(item: T): List<T>;
|
|
8
|
-
removeAt(index: number): List<T>;
|
|
9
|
-
get(index: number): T | undefined;
|
|
10
|
-
toArray(): readonly T[];
|
|
11
|
-
map<U>(f: (value: T) => U): List<U>;
|
|
12
|
-
flatMap<U>(f: (value: T) => List<U>): List<U>;
|
|
13
|
-
reduce<U>(f: (acc: U, value: T) => U): List<U>;
|
|
14
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
15
|
-
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
16
|
-
concat(other: List<T>): List<T>;
|
|
17
|
-
toString(): string;
|
|
18
|
-
}
|
|
2
|
+
import { IFunctor } from './index.cjs';
|
|
19
3
|
|
|
20
4
|
declare class Right<L, R> implements Either<L, R> {
|
|
21
5
|
value: R;
|
|
@@ -52,12 +36,4 @@ declare const left: <L, R>(value: L) => Either<L, R>;
|
|
|
52
36
|
declare const right: <L, R>(value: R) => Either<L, R>;
|
|
53
37
|
declare const parseNumber: (input: string) => Either<ParseError, number>;
|
|
54
38
|
|
|
55
|
-
|
|
56
|
-
map<U>(f: (value: T) => U): IFunctor<U>;
|
|
57
|
-
flatMap<U>(f: (value: T) => IFunctor<U>): IFunctor<U>;
|
|
58
|
-
reduce<U>(f: (acc: U, value: T) => U): IFunctor<U>;
|
|
59
|
-
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
60
|
-
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export { Either as E, IFunctor as I, List as L, Right as R, Left as a, left as l, parseNumber as p, right as r };
|
|
39
|
+
export { Either as E, Left as L, Right as R, left as l, parseNumber as p, right as r };
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
package/dist/index.d.cts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
interface IFunctor<T> {
|
|
2
|
+
map<U>(f: (value: T) => U): IFunctor<U>;
|
|
3
|
+
flatMap<U>(f: (value: T) => IFunctor<U>): IFunctor<U>;
|
|
4
|
+
reduce<U>(f: (acc: U, value: T) => U): IFunctor<U>;
|
|
5
|
+
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
6
|
+
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { IFunctor };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
interface IFunctor<T> {
|
|
2
|
+
map<U>(f: (value: T) => U): IFunctor<U>;
|
|
3
|
+
flatMap<U>(f: (value: T) => IFunctor<U>): IFunctor<U>;
|
|
4
|
+
reduce<U>(f: (acc: U, value: T) => U): IFunctor<U>;
|
|
5
|
+
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
6
|
+
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { IFunctor };
|
package/dist/index.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b as t,c as e}from"./chunk-QK5JVYJ3.js";import"./chunk-ABUN2GHU.js";import"./chunk-CN6MP6AJ.js";import"./chunk-ZTL76QDL.js";import{a as U}from"./chunk-E4GBAXJ4.js";import"./chunk-VTKL7OQI.js";export{U as List,a as left,e as parseNumber,t as right};
|
package/dist/list/List.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGWLTG6GZcjs = require('../chunk-GWLTG6GZ.cjs');var n=class r{constructor(t){_chunkGWLTG6GZcjs.a.call(void 0, this,"items");this.items=t?[...t]:[]}get length(){return this.items.length}add(t){return new r([...this.items,t])}removeAt(t){if(t<0||t>=this.items.length)return this;let e=[...this.items.slice(0,t),...this.items.slice(t+1)];return new r(e)}get(t){return this.items[t]}toArray(){return this.items}map(t){return new r(this.items.map(t))}flatMap(t){return this.items.reduce((e,s)=>e.concat(t(s)),new r)}reduce(t){let e=this.items.reduce(t,void 0);return new r([e])}foldLeft(t,e){return this.items.reduce(e,t)}foldRight(t,e){return this.items.reduceRight((s,u)=>e(u,s),t)}concat(t){return new r([...this.items,...t.items])}toString(){return`List(${this.items.toString()})`}};exports.List = n;
|
package/dist/list/List.d.cts
CHANGED
|
@@ -1,2 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { IFunctor } from '../index.cjs';
|
|
2
|
+
|
|
3
|
+
declare class List<T> implements IFunctor<T> {
|
|
4
|
+
private readonly items;
|
|
5
|
+
constructor(items?: T[]);
|
|
6
|
+
get length(): number;
|
|
7
|
+
add(item: T): List<T>;
|
|
8
|
+
removeAt(index: number): List<T>;
|
|
9
|
+
get(index: number): T | undefined;
|
|
10
|
+
toArray(): readonly T[];
|
|
11
|
+
map<U>(f: (value: T) => U): List<U>;
|
|
12
|
+
flatMap<U>(f: (value: T) => List<U>): List<U>;
|
|
13
|
+
reduce<U>(f: (acc: U, value: T) => U): List<U>;
|
|
14
|
+
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
15
|
+
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
16
|
+
concat(other: List<T>): List<T>;
|
|
17
|
+
toString(): string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { List };
|
package/dist/list/List.d.ts
CHANGED
|
@@ -1,2 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { IFunctor } from '../index.js';
|
|
2
|
+
|
|
3
|
+
declare class List<T> implements IFunctor<T> {
|
|
4
|
+
private readonly items;
|
|
5
|
+
constructor(items?: T[]);
|
|
6
|
+
get length(): number;
|
|
7
|
+
add(item: T): List<T>;
|
|
8
|
+
removeAt(index: number): List<T>;
|
|
9
|
+
get(index: number): T | undefined;
|
|
10
|
+
toArray(): readonly T[];
|
|
11
|
+
map<U>(f: (value: T) => U): List<U>;
|
|
12
|
+
flatMap<U>(f: (value: T) => List<U>): List<U>;
|
|
13
|
+
reduce<U>(f: (acc: U, value: T) => U): List<U>;
|
|
14
|
+
foldLeft<U>(initialValue: U, f: (acc: U, value: T) => U): U;
|
|
15
|
+
foldRight<U>(initialValue: U, f: (value: T, acc: U) => U): U;
|
|
16
|
+
concat(other: List<T>): List<T>;
|
|
17
|
+
toString(): string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { List };
|
package/dist/list/List.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a as i}from"../chunk-VTKL7OQI.js";var n=class r{constructor(t){i(this,"items");this.items=t?[...t]:[]}get length(){return this.items.length}add(t){return new r([...this.items,t])}removeAt(t){if(t<0||t>=this.items.length)return this;let e=[...this.items.slice(0,t),...this.items.slice(t+1)];return new r(e)}get(t){return this.items[t]}toArray(){return this.items}map(t){return new r(this.items.map(t))}flatMap(t){return this.items.reduce((e,s)=>e.concat(t(s)),new r)}reduce(t){let e=this.items.reduce(t,void 0);return new r([e])}foldLeft(t,e){return this.items.reduce(e,t)}foldRight(t,e){return this.items.reduceRight((s,u)=>e(u,s),t)}concat(t){return new r([...this.items,...t.items])}toString(){return`List(${this.items.toString()})`}};export{n as List};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "functype",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "A small functional library for TypeScript",
|
|
5
5
|
"author": "jordan.burke@gmail.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,15 +20,14 @@
|
|
|
20
20
|
"prettier": "^3.0.3",
|
|
21
21
|
"rimraf": "^5.0.1",
|
|
22
22
|
"tsup": "^7.2.0",
|
|
23
|
-
"ts-jest": "^29.1.1"
|
|
24
|
-
},
|
|
25
|
-
"main": "lib/index.cjs",
|
|
26
|
-
"module": "lib/index.js",
|
|
27
|
-
"types": "lib/index.d.ts",
|
|
28
|
-
"type": "module",
|
|
29
|
-
"dependencies": {
|
|
23
|
+
"ts-jest": "^29.1.1",
|
|
30
24
|
"typescript": "^5.1.6"
|
|
31
25
|
},
|
|
26
|
+
"main": "dist/index.cjs",
|
|
27
|
+
"module": "dist/index.js",
|
|
28
|
+
"types": "dist/index.d.ts",
|
|
29
|
+
"type": "module",
|
|
30
|
+
"dependencies": {},
|
|
32
31
|
"files": [
|
|
33
32
|
"lib",
|
|
34
33
|
"dist"
|
package/dist/chunk-E4GBAXJ4.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as i}from"./chunk-VTKL7OQI.js";var n=class r{constructor(t){i(this,"items");this.items=t?[...t]:[]}get length(){return this.items.length}add(t){return new r([...this.items,t])}removeAt(t){if(t<0||t>=this.items.length)return this;let e=[...this.items.slice(0,t),...this.items.slice(t+1)];return new r(e)}get(t){return this.items[t]}toArray(){return this.items}map(t){return new r(this.items.map(t))}flatMap(t){return this.items.reduce((e,s)=>e.concat(t(s)),new r)}reduce(t){let e=this.items.reduce(t,void 0);return new r([e])}foldLeft(t,e){return this.items.reduce(e,t)}foldRight(t,e){return this.items.reduceRight((s,u)=>e(u,s),t)}concat(t){return new r([...this.items,...t.items])}toString(){return`List(${this.items.toString()})`}};export{n as a};
|
package/dist/chunk-HWJMIJH6.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk4EVP3IRIcjs = require('./chunk-4EVP3IRI.cjs');var _chunkCB3ZZ3RLcjs = require('./chunk-CB3ZZ3RL.cjs');var _chunk6VKVA3TKcjs = require('./chunk-6VKVA3TK.cjs');var s=r=>new (0, _chunk4EVP3IRIcjs.a)(r),n= exports.b =r=>new (0, _chunkCB3ZZ3RLcjs.a)(r),h= exports.c =r=>{let t=parseInt(r,10);return isNaN(t)?s(new (0, _chunk6VKVA3TKcjs.a)(`${t}`)):n(t)};exports.a = s; exports.b = n; exports.c = h;
|
package/dist/chunk-PXY4XULG.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGWLTG6GZcjs = require('./chunk-GWLTG6GZ.cjs');var n=class r{constructor(t){_chunkGWLTG6GZcjs.a.call(void 0, this,"items");this.items=t?[...t]:[]}get length(){return this.items.length}add(t){return new r([...this.items,t])}removeAt(t){if(t<0||t>=this.items.length)return this;let e=[...this.items.slice(0,t),...this.items.slice(t+1)];return new r(e)}get(t){return this.items[t]}toArray(){return this.items}map(t){return new r(this.items.map(t))}flatMap(t){return this.items.reduce((e,s)=>e.concat(t(s)),new r)}reduce(t){let e=this.items.reduce(t,void 0);return new r([e])}foldLeft(t,e){return this.items.reduce(e,t)}foldRight(t,e){return this.items.reduceRight((s,u)=>e(u,s),t)}concat(t){return new r([...this.items,...t.items])}toString(){return`List(${this.items.toString()})`}};exports.a = n;
|
package/dist/chunk-QK5JVYJ3.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as i}from"./chunk-ABUN2GHU.js";import{a as o}from"./chunk-CN6MP6AJ.js";import{a as e}from"./chunk-ZTL76QDL.js";var s=r=>new i(r),n=r=>new o(r),h=r=>{let t=parseInt(r,10);return isNaN(t)?s(new e(`${t}`)):n(t)};export{s as a,n as b,h as c};
|