@lsby/ts-fp-data 0.2.4 → 0.2.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.
@@ -28,6 +28,12 @@ module.exports = __toCommonJS(either_exports);
28
28
 
29
29
  // src/data/maybe.ts
30
30
  var Maybe = class {
31
+ static nothing() {
32
+ return new Nothing();
33
+ }
34
+ static just(a) {
35
+ return new Just(a);
36
+ }
31
37
  static pure(a) {
32
38
  return new Just(a);
33
39
  }
@@ -100,6 +106,12 @@ var Nothing = class _Nothing extends Maybe {
100
106
 
101
107
  // src/data/either.ts
102
108
  var Either = class _Either {
109
+ static left(a) {
110
+ return new Left(a);
111
+ }
112
+ static right(a) {
113
+ return new Right(a);
114
+ }
103
115
  static pure(a) {
104
116
  return new Right(a);
105
117
  }
@@ -5,6 +5,8 @@ type 任意Either = Either<any, any>;
5
5
  type 计算右值们<A> = A extends [] ? [] : A extends [infer x, ...infer xs] ? x extends Either<unknown, infer c> ? [c, ...计算右值们<xs>] : never : never;
6
6
  type 计算左值们<A> = A extends [] ? [] : A extends [infer x, ...infer xs] ? x extends Either<infer c, unknown> ? [c, ...计算左值们<xs>] : never : never;
7
7
  declare abstract class Either<L, R> {
8
+ static left<L, R>(a: L): Either<L, R>;
9
+ static right<L, R>(a: R): Either<L, R>;
8
10
  static pure<L, R>(a: R): Either<L, R>;
9
11
  static lift<B, Arr extends 任意Either[]>(arr: [...Arr], f: (a: 计算右值们<Arr>) => B): Either<_____<计算左值们<Arr>>, B>;
10
12
  abstract map<B>(_f: (a: R) => B): Either<L, B>;
@@ -26,6 +26,12 @@ __export(maybe_exports, {
26
26
  });
27
27
  module.exports = __toCommonJS(maybe_exports);
28
28
  var Maybe = class {
29
+ static nothing() {
30
+ return new Nothing();
31
+ }
32
+ static just(a) {
33
+ return new Just(a);
34
+ }
29
35
  static pure(a) {
30
36
  return new Just(a);
31
37
  }
@@ -1,4 +1,6 @@
1
1
  declare abstract class Maybe<A> {
2
+ static nothing<A>(): Maybe<A>;
3
+ static just<A>(a: A): Maybe<A>;
2
4
  static pure<A>(a: A): Maybe<A>;
3
5
  abstract map<B>(f: (a: A) => B): Maybe<B>;
4
6
  abstract bind<B>(f: (a: A) => Maybe<B>): Maybe<B>;
@@ -27,6 +27,12 @@ module.exports = __toCommonJS(task_exports);
27
27
 
28
28
  // src/data/maybe.ts
29
29
  var Maybe = class {
30
+ static nothing() {
31
+ return new Nothing();
32
+ }
33
+ static just(a) {
34
+ return new Just(a);
35
+ }
30
36
  static pure(a) {
31
37
  return new Just(a);
32
38
  }
@@ -99,6 +105,12 @@ var Nothing = class _Nothing extends Maybe {
99
105
 
100
106
  // src/data/either.ts
101
107
  var Either = class _Either {
108
+ static left(a) {
109
+ return new Left(a);
110
+ }
111
+ static right(a) {
112
+ return new Right(a);
113
+ }
102
114
  static pure(a) {
103
115
  return new Right(a);
104
116
  }
@@ -34,6 +34,12 @@ module.exports = __toCommonJS(seq_exports);
34
34
 
35
35
  // src/data/maybe.ts
36
36
  var Maybe = class {
37
+ static nothing() {
38
+ return new Nothing();
39
+ }
40
+ static just(a) {
41
+ return new Just(a);
42
+ }
37
43
  static pure(a) {
38
44
  return new Just(a);
39
45
  }
@@ -106,6 +112,12 @@ var Nothing = class _Nothing extends Maybe {
106
112
 
107
113
  // src/data/either.ts
108
114
  var Either = class _Either {
115
+ static left(a) {
116
+ return new Left(a);
117
+ }
118
+ static right(a) {
119
+ return new Right(a);
120
+ }
109
121
  static pure(a) {
110
122
  return new Right(a);
111
123
  }
@@ -45,6 +45,12 @@ module.exports = __toCommonJS(src_exports);
45
45
 
46
46
  // src/data/maybe.ts
47
47
  var Maybe = class {
48
+ static nothing() {
49
+ return new Nothing();
50
+ }
51
+ static just(a) {
52
+ return new Just(a);
53
+ }
48
54
  static pure(a) {
49
55
  return new Just(a);
50
56
  }
@@ -117,6 +123,12 @@ var Nothing = class _Nothing extends Maybe {
117
123
 
118
124
  // src/data/either.ts
119
125
  var Either = class _Either {
126
+ static left(a) {
127
+ return new Left(a);
128
+ }
129
+ static right(a) {
130
+ return new Right(a);
131
+ }
120
132
  static pure(a) {
121
133
  return new Right(a);
122
134
  }
@@ -1,10 +1,16 @@
1
1
  import {
2
2
  Just,
3
3
  Nothing
4
- } from "./chunk-NXA54GUD.js";
4
+ } from "./chunk-CE6K56ZX.js";
5
5
 
6
6
  // src/data/either.ts
7
7
  var Either = class _Either {
8
+ static left(a) {
9
+ return new Left(a);
10
+ }
11
+ static right(a) {
12
+ return new Right(a);
13
+ }
8
14
  static pure(a) {
9
15
  return new Right(a);
10
16
  }
@@ -1,5 +1,11 @@
1
1
  // src/data/maybe.ts
2
2
  var Maybe = class {
3
+ static nothing() {
4
+ return new Nothing();
5
+ }
6
+ static just(a) {
7
+ return new Just(a);
8
+ }
3
9
  static pure(a) {
4
10
  return new Just(a);
5
11
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Left,
3
3
  Right
4
- } from "./chunk-XGZ7K75X.js";
4
+ } from "./chunk-2TQ3IMR2.js";
5
5
 
6
6
  // src/data/task.ts
7
7
  var TaskDo = class _TaskDo {
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  Task
3
- } from "./chunk-E3TSSKMR.js";
3
+ } from "./chunk-UBCNNCCC.js";
4
4
  import {
5
5
  Left,
6
6
  Right
7
- } from "./chunk-XGZ7K75X.js";
7
+ } from "./chunk-2TQ3IMR2.js";
8
8
  import {
9
9
  Just,
10
10
  Nothing
11
- } from "./chunk-NXA54GUD.js";
11
+ } from "./chunk-CE6K56ZX.js";
12
12
 
13
13
  // src/func/seq.ts
14
14
  function seqArrayTask(a) {
@@ -5,6 +5,8 @@ type 任意Either = Either<any, any>;
5
5
  type 计算右值们<A> = A extends [] ? [] : A extends [infer x, ...infer xs] ? x extends Either<unknown, infer c> ? [c, ...计算右值们<xs>] : never : never;
6
6
  type 计算左值们<A> = A extends [] ? [] : A extends [infer x, ...infer xs] ? x extends Either<infer c, unknown> ? [c, ...计算左值们<xs>] : never : never;
7
7
  declare abstract class Either<L, R> {
8
+ static left<L, R>(a: L): Either<L, R>;
9
+ static right<L, R>(a: R): Either<L, R>;
8
10
  static pure<L, R>(a: R): Either<L, R>;
9
11
  static lift<B, Arr extends 任意Either[]>(arr: [...Arr], f: (a: 计算右值们<Arr>) => B): Either<_____<计算左值们<Arr>>, B>;
10
12
  abstract map<B>(_f: (a: R) => B): Either<L, B>;
@@ -2,8 +2,8 @@ import {
2
2
  Either,
3
3
  Left,
4
4
  Right
5
- } from "../chunk-XGZ7K75X.js";
6
- import "../chunk-NXA54GUD.js";
5
+ } from "../chunk-2TQ3IMR2.js";
6
+ import "../chunk-CE6K56ZX.js";
7
7
  export {
8
8
  Either,
9
9
  Left,
@@ -1,4 +1,6 @@
1
1
  declare abstract class Maybe<A> {
2
+ static nothing<A>(): Maybe<A>;
3
+ static just<A>(a: A): Maybe<A>;
2
4
  static pure<A>(a: A): Maybe<A>;
3
5
  abstract map<B>(f: (a: A) => B): Maybe<B>;
4
6
  abstract bind<B>(f: (a: A) => Maybe<B>): Maybe<B>;
@@ -2,7 +2,7 @@ import {
2
2
  Just,
3
3
  Maybe,
4
4
  Nothing
5
- } from "../chunk-NXA54GUD.js";
5
+ } from "../chunk-CE6K56ZX.js";
6
6
  export {
7
7
  Just,
8
8
  Maybe,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  Task,
3
3
  TaskDo
4
- } from "../chunk-E3TSSKMR.js";
5
- import "../chunk-XGZ7K75X.js";
6
- import "../chunk-NXA54GUD.js";
4
+ } from "../chunk-UBCNNCCC.js";
5
+ import "../chunk-2TQ3IMR2.js";
6
+ import "../chunk-CE6K56ZX.js";
7
7
  export {
8
8
  Task,
9
9
  TaskDo
@@ -8,10 +8,10 @@ import {
8
8
  seqEitherTask,
9
9
  seqMaybeArray,
10
10
  seqMaybeTask
11
- } from "../chunk-BKOGTDCP.js";
12
- import "../chunk-E3TSSKMR.js";
13
- import "../chunk-XGZ7K75X.js";
14
- import "../chunk-NXA54GUD.js";
11
+ } from "../chunk-UFP2YX5Y.js";
12
+ import "../chunk-UBCNNCCC.js";
13
+ import "../chunk-2TQ3IMR2.js";
14
+ import "../chunk-CE6K56ZX.js";
15
15
  export {
16
16
  seqArrayEitherCollectRight,
17
17
  seqArrayEitherFirstLeft,
package/dist/esm/index.js CHANGED
@@ -13,21 +13,21 @@ import {
13
13
  seqEitherTask,
14
14
  seqMaybeArray,
15
15
  seqMaybeTask
16
- } from "./chunk-BKOGTDCP.js";
16
+ } from "./chunk-UFP2YX5Y.js";
17
17
  import {
18
18
  Task,
19
19
  TaskDo
20
- } from "./chunk-E3TSSKMR.js";
20
+ } from "./chunk-UBCNNCCC.js";
21
21
  import {
22
22
  Either,
23
23
  Left,
24
24
  Right
25
- } from "./chunk-XGZ7K75X.js";
25
+ } from "./chunk-2TQ3IMR2.js";
26
26
  import {
27
27
  Just,
28
28
  Maybe,
29
29
  Nothing
30
- } from "./chunk-NXA54GUD.js";
30
+ } from "./chunk-CE6K56ZX.js";
31
31
  export {
32
32
  Either,
33
33
  Just,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lsby/ts-fp-data",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "require": "./dist/cjs/index.cjs",