functype 0.0.2 → 0.0.3

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.
@@ -0,0 +1 @@
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};
@@ -0,0 +1 @@
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;
@@ -0,0 +1 @@
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;
@@ -0,0 +1 @@
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};
@@ -1,3 +1,2 @@
1
- export { L as Left } from '../index-402b9aa2.js';
2
- import '../index.cjs';
1
+ export { a as Left } from '../index-7c5c3a08.js';
3
2
  import '../error/ParseError.cjs';
@@ -1,3 +1,2 @@
1
- export { L as Left } from '../index-28de5927.js';
2
- import '../index.js';
1
+ export { a as Left } from '../index-92d6660e.js';
3
2
  import '../error/ParseError.js';
@@ -1,3 +1,2 @@
1
- export { R as Right } from '../index-402b9aa2.js';
2
- import '../index.cjs';
1
+ export { R as Right } from '../index-7c5c3a08.js';
3
2
  import '../error/ParseError.cjs';
@@ -1,3 +1,2 @@
1
- export { R as Right } from '../index-28de5927.js';
2
- import '../index.js';
1
+ export { R as Right } from '../index-92d6660e.js';
3
2
  import '../error/ParseError.js';
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHWJMIJH6cjs = require('../chunk-HWJMIJH6.cjs');require('../chunk-4EVP3IRI.cjs');require('../chunk-CB3ZZ3RL.cjs');require('../chunk-6VKVA3TK.cjs');require('../chunk-GWLTG6GZ.cjs');exports.left = _chunkHWJMIJH6cjs.a; exports.parseNumber = _chunkHWJMIJH6cjs.c; exports.right = _chunkHWJMIJH6cjs.b;
@@ -1,3 +1,2 @@
1
1
  import '../error/ParseError.cjs';
2
- export { E as Either, l as left, p as parseNumber, r as right } from '../index-402b9aa2.js';
3
- import '../index.cjs';
2
+ export { E as Either, l as left, p as parseNumber, r as right } from '../index-7c5c3a08.js';
@@ -1,3 +1,2 @@
1
1
  import '../error/ParseError.js';
2
- export { E as Either, l as left, p as parseNumber, r as right } from '../index-28de5927.js';
3
- import '../index.js';
2
+ export { E as Either, l as left, p as parseNumber, r as right } from '../index-92d6660e.js';
@@ -1 +1 @@
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
+ import{a,b,c}from"../chunk-QK5JVYJ3.js";import"../chunk-ABUN2GHU.js";import"../chunk-CN6MP6AJ.js";import"../chunk-ZTL76QDL.js";import"../chunk-VTKL7OQI.js";export{a as left,c as parseNumber,b as right};
@@ -1,5 +1,21 @@
1
1
  import { ParseError } from './error/ParseError.cjs';
2
- 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
+ }
3
19
 
4
20
  declare class Right<L, R> implements Either<L, R> {
5
21
  value: R;
@@ -36,4 +52,12 @@ declare const left: <L, R>(value: L) => Either<L, R>;
36
52
  declare const right: <L, R>(value: R) => Either<L, R>;
37
53
  declare const parseNumber: (input: string) => Either<ParseError, number>;
38
54
 
39
- export { Either as E, Left as L, Right as R, left as l, parseNumber as p, right as r };
55
+ interface IFunctor<T> {
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 };
@@ -1,5 +1,21 @@
1
1
  import { ParseError } from './error/ParseError.js';
2
- 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
+ }
3
19
 
4
20
  declare class Right<L, R> implements Either<L, R> {
5
21
  value: R;
@@ -36,4 +52,12 @@ declare const left: <L, R>(value: L) => Either<L, R>;
36
52
  declare const right: <L, R>(value: R) => Either<L, R>;
37
53
  declare const parseNumber: (input: string) => Either<ParseError, number>;
38
54
 
39
- export { Either as E, Left as L, Right as R, left as l, parseNumber as p, right as r };
55
+ interface IFunctor<T> {
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 };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHWJMIJH6cjs = require('./chunk-HWJMIJH6.cjs');require('./chunk-4EVP3IRI.cjs');require('./chunk-CB3ZZ3RL.cjs');require('./chunk-6VKVA3TK.cjs');var _chunkPXY4XULGcjs = require('./chunk-PXY4XULG.cjs');require('./chunk-GWLTG6GZ.cjs');exports.List = _chunkPXY4XULGcjs.a; exports.left = _chunkHWJMIJH6cjs.a; exports.parseNumber = _chunkHWJMIJH6cjs.c; exports.right = _chunkHWJMIJH6cjs.b;
package/dist/index.d.cts CHANGED
@@ -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 };
1
+ export { E as Either, I as IFunctor, L as List, l as left, p as parseNumber, r as right } from './index-7c5c3a08.js';
2
+ import './error/ParseError.cjs';
package/dist/index.d.ts CHANGED
@@ -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 };
1
+ export { E as Either, I as IFunctor, L as List, l as left, p as parseNumber, r as right } from './index-92d6660e.js';
2
+ import './error/ParseError.js';
package/dist/index.js CHANGED
@@ -0,0 +1 @@
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};
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkPXY4XULGcjs = require('../chunk-PXY4XULG.cjs');require('../chunk-GWLTG6GZ.cjs');exports.List = _chunkPXY4XULGcjs.a;
@@ -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 };
1
+ export { L as List } from '../index-7c5c3a08.js';
2
+ import '../error/ParseError.cjs';
@@ -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 };
1
+ export { L as List } from '../index-92d6660e.js';
2
+ import '../error/ParseError.js';
package/dist/list/List.js CHANGED
@@ -1 +1 @@
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};
1
+ import{a}from"../chunk-E4GBAXJ4.js";import"../chunk-VTKL7OQI.js";export{a as List};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "functype",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "A small functional library for TypeScript",
5
5
  "author": "jordan.burke@gmail.com",
6
6
  "license": "MIT",