@nlozgachev/pipelined 0.39.0 → 0.41.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/README.md +2 -2
- package/dist/Duration-BTeT9D-q.d.mts +127 -0
- package/dist/Duration-BTeT9D-q.d.ts +127 -0
- package/dist/{Task-uupX7xd9.d.ts → Task-BprUabHP.d.mts} +3 -2
- package/dist/{Task-DcXhCZYg.d.mts → Task-Dt3ZMen6.d.ts} +3 -2
- package/dist/{chunk-4R4XUP4M.mjs → chunk-COGQKPIP.mjs} +3 -3
- package/dist/{chunk-5AFEEFE4.mjs → chunk-GBB6LVLI.mjs} +2 -2
- package/dist/{chunk-3Q5UBRYB.mjs → chunk-TCE2UETM.mjs} +88 -4
- package/dist/{chunk-GTJ2YCYY.mjs → chunk-V37OUM35.mjs} +9 -8
- package/dist/composition.d.mts +128 -1
- package/dist/composition.d.ts +128 -1
- package/dist/composition.js +111 -4
- package/dist/composition.mjs +2 -1
- package/dist/core.d.mts +5 -4
- package/dist/core.d.ts +5 -4
- package/dist/core.js +2 -2
- package/dist/core.mjs +2 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +123 -40
- package/dist/index.mjs +4 -4
- package/dist/types.d.mts +2 -126
- package/dist/types.d.ts +2 -126
- package/dist/types.mjs +1 -1
- package/dist/utils.d.mts +17 -5
- package/dist/utils.d.ts +17 -5
- package/dist/utils.js +12 -11
- package/dist/utils.mjs +3 -3
- package/package.json +2 -2
package/dist/types.d.mts
CHANGED
|
@@ -1,128 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Brand<K, T> creates a nominal type by tagging T with a phantom brand K.
|
|
4
|
-
* Prevents accidentally mixing up values that share the same underlying type.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```ts
|
|
8
|
-
* type UserId = Brand<"UserId", string>;
|
|
9
|
-
* type ProductId = Brand<"ProductId", string>;
|
|
10
|
-
*
|
|
11
|
-
* const toUserId = Brand.wrap<"UserId", string>();
|
|
12
|
-
* const toProductId = Brand.wrap<"ProductId", string>();
|
|
13
|
-
*
|
|
14
|
-
* const userId: UserId = toUserId("user-123");
|
|
15
|
-
* const productId: ProductId = toProductId("prod-456");
|
|
16
|
-
*
|
|
17
|
-
* // Type error: ProductId is not assignable to UserId
|
|
18
|
-
* // const wrong: UserId = productId;
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
type Brand<K extends string, T> = T & {
|
|
22
|
-
readonly [_brand]: K;
|
|
23
|
-
};
|
|
24
|
-
declare namespace Brand {
|
|
25
|
-
/**
|
|
26
|
-
* Returns a constructor that wraps a value of type T in brand K.
|
|
27
|
-
* The resulting function performs an unchecked cast — only use when the raw
|
|
28
|
-
* value is known to satisfy the brand's invariants.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```ts
|
|
32
|
-
* type PositiveNumber = Brand<"PositiveNumber", number>;
|
|
33
|
-
* const toPositiveNumber = Brand.wrap<"PositiveNumber", number>();
|
|
34
|
-
*
|
|
35
|
-
* const n: PositiveNumber = toPositiveNumber(42);
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
const wrap: <K extends string, T>() => (value: T) => Brand<K, T>;
|
|
39
|
-
/**
|
|
40
|
-
* Strips the brand and returns the underlying value.
|
|
41
|
-
* Since Brand<K, T> extends T this is rarely needed, but can improve readability.
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```ts
|
|
45
|
-
* const userId: UserId = toUserId("user-123");
|
|
46
|
-
* const raw: string = Brand.unwrap(userId); // "user-123"
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
const unwrap: <K extends string, T>(branded: Brand<K, T>) => T;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* A branded nominal type representing a duration of time in milliseconds.
|
|
54
|
-
* Use Duration to ensure safe time-based operators and clear unit conversions.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* const halfSecond = Duration.milliseconds(500);
|
|
59
|
-
* const twoSeconds = Duration.seconds(2);
|
|
60
|
-
* const total = pipe(halfSecond, Duration.add(twoSeconds));
|
|
61
|
-
*
|
|
62
|
-
* Duration.toSeconds(total); // 2.5
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
type Duration = Brand<"Duration", number>;
|
|
66
|
-
declare namespace Duration {
|
|
67
|
-
/**
|
|
68
|
-
* Creates a Duration from milliseconds.
|
|
69
|
-
*/
|
|
70
|
-
const milliseconds: (ms: number) => Duration;
|
|
71
|
-
/**
|
|
72
|
-
* Creates a Duration from seconds.
|
|
73
|
-
*/
|
|
74
|
-
const seconds: (s: number) => Duration;
|
|
75
|
-
/**
|
|
76
|
-
* Creates a Duration from minutes.
|
|
77
|
-
*/
|
|
78
|
-
const minutes: (m: number) => Duration;
|
|
79
|
-
/**
|
|
80
|
-
* Creates a Duration from hours.
|
|
81
|
-
*/
|
|
82
|
-
const hours: (h: number) => Duration;
|
|
83
|
-
/**
|
|
84
|
-
* Creates a Duration from days.
|
|
85
|
-
*/
|
|
86
|
-
const days: (d: number) => Duration;
|
|
87
|
-
/**
|
|
88
|
-
* Converts a Duration back to raw milliseconds.
|
|
89
|
-
*/
|
|
90
|
-
const toMilliseconds: (d: Duration) => number;
|
|
91
|
-
/**
|
|
92
|
-
* Converts a Duration to seconds.
|
|
93
|
-
*/
|
|
94
|
-
const toSeconds: (d: Duration) => number;
|
|
95
|
-
/**
|
|
96
|
-
* Converts a Duration to minutes.
|
|
97
|
-
*/
|
|
98
|
-
const toMinutes: (d: Duration) => number;
|
|
99
|
-
/**
|
|
100
|
-
* Converts a Duration to hours.
|
|
101
|
-
*/
|
|
102
|
-
const toHours: (d: Duration) => number;
|
|
103
|
-
/**
|
|
104
|
-
* Converts a Duration to days.
|
|
105
|
-
*/
|
|
106
|
-
const toDays: (d: Duration) => number;
|
|
107
|
-
/**
|
|
108
|
-
* Adds two Durations together.
|
|
109
|
-
*
|
|
110
|
-
* @example
|
|
111
|
-
* ```ts
|
|
112
|
-
* pipe(Duration.seconds(1), Duration.add(Duration.milliseconds(500))); // 1500ms
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
const add: (other: Duration) => (self: Duration) => Duration;
|
|
116
|
-
/**
|
|
117
|
-
* Subtracts the other Duration from this one.
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* ```ts
|
|
121
|
-
* pipe(Duration.seconds(1), Duration.subtract(Duration.milliseconds(500))); // 500ms
|
|
122
|
-
* ```
|
|
123
|
-
*/
|
|
124
|
-
const subtract: (other: Duration) => (self: Duration) => Duration;
|
|
125
|
-
}
|
|
1
|
+
export { B as Brand, D as Duration } from './Duration-BTeT9D-q.mjs';
|
|
126
2
|
|
|
127
3
|
/**
|
|
128
4
|
* A list that is guaranteed to have at least one element.
|
|
@@ -153,4 +29,4 @@ type NonEmptyList<A> = readonly [A, ...A[]];
|
|
|
153
29
|
*/
|
|
154
30
|
declare const isNonEmptyList: <A>(list: readonly A[]) => list is NonEmptyList<A>;
|
|
155
31
|
|
|
156
|
-
export {
|
|
32
|
+
export { type NonEmptyList, isNonEmptyList };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,128 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Brand<K, T> creates a nominal type by tagging T with a phantom brand K.
|
|
4
|
-
* Prevents accidentally mixing up values that share the same underlying type.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```ts
|
|
8
|
-
* type UserId = Brand<"UserId", string>;
|
|
9
|
-
* type ProductId = Brand<"ProductId", string>;
|
|
10
|
-
*
|
|
11
|
-
* const toUserId = Brand.wrap<"UserId", string>();
|
|
12
|
-
* const toProductId = Brand.wrap<"ProductId", string>();
|
|
13
|
-
*
|
|
14
|
-
* const userId: UserId = toUserId("user-123");
|
|
15
|
-
* const productId: ProductId = toProductId("prod-456");
|
|
16
|
-
*
|
|
17
|
-
* // Type error: ProductId is not assignable to UserId
|
|
18
|
-
* // const wrong: UserId = productId;
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
type Brand<K extends string, T> = T & {
|
|
22
|
-
readonly [_brand]: K;
|
|
23
|
-
};
|
|
24
|
-
declare namespace Brand {
|
|
25
|
-
/**
|
|
26
|
-
* Returns a constructor that wraps a value of type T in brand K.
|
|
27
|
-
* The resulting function performs an unchecked cast — only use when the raw
|
|
28
|
-
* value is known to satisfy the brand's invariants.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```ts
|
|
32
|
-
* type PositiveNumber = Brand<"PositiveNumber", number>;
|
|
33
|
-
* const toPositiveNumber = Brand.wrap<"PositiveNumber", number>();
|
|
34
|
-
*
|
|
35
|
-
* const n: PositiveNumber = toPositiveNumber(42);
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
const wrap: <K extends string, T>() => (value: T) => Brand<K, T>;
|
|
39
|
-
/**
|
|
40
|
-
* Strips the brand and returns the underlying value.
|
|
41
|
-
* Since Brand<K, T> extends T this is rarely needed, but can improve readability.
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```ts
|
|
45
|
-
* const userId: UserId = toUserId("user-123");
|
|
46
|
-
* const raw: string = Brand.unwrap(userId); // "user-123"
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
const unwrap: <K extends string, T>(branded: Brand<K, T>) => T;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* A branded nominal type representing a duration of time in milliseconds.
|
|
54
|
-
* Use Duration to ensure safe time-based operators and clear unit conversions.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* const halfSecond = Duration.milliseconds(500);
|
|
59
|
-
* const twoSeconds = Duration.seconds(2);
|
|
60
|
-
* const total = pipe(halfSecond, Duration.add(twoSeconds));
|
|
61
|
-
*
|
|
62
|
-
* Duration.toSeconds(total); // 2.5
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
type Duration = Brand<"Duration", number>;
|
|
66
|
-
declare namespace Duration {
|
|
67
|
-
/**
|
|
68
|
-
* Creates a Duration from milliseconds.
|
|
69
|
-
*/
|
|
70
|
-
const milliseconds: (ms: number) => Duration;
|
|
71
|
-
/**
|
|
72
|
-
* Creates a Duration from seconds.
|
|
73
|
-
*/
|
|
74
|
-
const seconds: (s: number) => Duration;
|
|
75
|
-
/**
|
|
76
|
-
* Creates a Duration from minutes.
|
|
77
|
-
*/
|
|
78
|
-
const minutes: (m: number) => Duration;
|
|
79
|
-
/**
|
|
80
|
-
* Creates a Duration from hours.
|
|
81
|
-
*/
|
|
82
|
-
const hours: (h: number) => Duration;
|
|
83
|
-
/**
|
|
84
|
-
* Creates a Duration from days.
|
|
85
|
-
*/
|
|
86
|
-
const days: (d: number) => Duration;
|
|
87
|
-
/**
|
|
88
|
-
* Converts a Duration back to raw milliseconds.
|
|
89
|
-
*/
|
|
90
|
-
const toMilliseconds: (d: Duration) => number;
|
|
91
|
-
/**
|
|
92
|
-
* Converts a Duration to seconds.
|
|
93
|
-
*/
|
|
94
|
-
const toSeconds: (d: Duration) => number;
|
|
95
|
-
/**
|
|
96
|
-
* Converts a Duration to minutes.
|
|
97
|
-
*/
|
|
98
|
-
const toMinutes: (d: Duration) => number;
|
|
99
|
-
/**
|
|
100
|
-
* Converts a Duration to hours.
|
|
101
|
-
*/
|
|
102
|
-
const toHours: (d: Duration) => number;
|
|
103
|
-
/**
|
|
104
|
-
* Converts a Duration to days.
|
|
105
|
-
*/
|
|
106
|
-
const toDays: (d: Duration) => number;
|
|
107
|
-
/**
|
|
108
|
-
* Adds two Durations together.
|
|
109
|
-
*
|
|
110
|
-
* @example
|
|
111
|
-
* ```ts
|
|
112
|
-
* pipe(Duration.seconds(1), Duration.add(Duration.milliseconds(500))); // 1500ms
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
const add: (other: Duration) => (self: Duration) => Duration;
|
|
116
|
-
/**
|
|
117
|
-
* Subtracts the other Duration from this one.
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* ```ts
|
|
121
|
-
* pipe(Duration.seconds(1), Duration.subtract(Duration.milliseconds(500))); // 500ms
|
|
122
|
-
* ```
|
|
123
|
-
*/
|
|
124
|
-
const subtract: (other: Duration) => (self: Duration) => Duration;
|
|
125
|
-
}
|
|
1
|
+
export { B as Brand, D as Duration } from './Duration-BTeT9D-q.js';
|
|
126
2
|
|
|
127
3
|
/**
|
|
128
4
|
* A list that is guaranteed to have at least one element.
|
|
@@ -153,4 +29,4 @@ type NonEmptyList<A> = readonly [A, ...A[]];
|
|
|
153
29
|
*/
|
|
154
30
|
declare const isNonEmptyList: <A>(list: readonly A[]) => list is NonEmptyList<A>;
|
|
155
31
|
|
|
156
|
-
export {
|
|
32
|
+
export { type NonEmptyList, isNonEmptyList };
|
package/dist/types.mjs
CHANGED
package/dist/utils.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { M as Maybe, R as Result, E as Equality, b as Ordering, T as Task } from './Task-
|
|
1
|
+
import { M as Maybe, R as Result, E as Equality, b as Ordering, T as Task } from './Task-BprUabHP.mjs';
|
|
2
2
|
import { NonEmptyList } from './types.mjs';
|
|
3
|
+
import './Duration-BTeT9D-q.mjs';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Functional array utilities that compose well with pipe.
|
|
@@ -523,7 +524,7 @@ declare namespace Arr {
|
|
|
523
524
|
*
|
|
524
525
|
* @example
|
|
525
526
|
* ```ts
|
|
526
|
-
* import { Dict } from "@nlozgachev/pipelined/
|
|
527
|
+
* import { Dict } from "@nlozgachev/pipelined/data";
|
|
527
528
|
* import { pipe } from "@nlozgachev/pipelined/composition";
|
|
528
529
|
*
|
|
529
530
|
* const scores = pipe(
|
|
@@ -844,7 +845,7 @@ declare namespace Dict {
|
|
|
844
845
|
*
|
|
845
846
|
* @example
|
|
846
847
|
* ```ts
|
|
847
|
-
* import { Num } from "@nlozgachev/pipelined/
|
|
848
|
+
* import { Num } from "@nlozgachev/pipelined/data";
|
|
848
849
|
* import { pipe } from "@nlozgachev/pipelined/composition";
|
|
849
850
|
*
|
|
850
851
|
* pipe(
|
|
@@ -893,6 +894,17 @@ declare namespace Num {
|
|
|
893
894
|
* ```
|
|
894
895
|
*/
|
|
895
896
|
const between: (min: number, max: number) => (n: number) => boolean;
|
|
897
|
+
/**
|
|
898
|
+
* Returns `true` when the number is in the range `[start, end)` (inclusive of `start`, exclusive of `end`).
|
|
899
|
+
*
|
|
900
|
+
* @example
|
|
901
|
+
* ```ts
|
|
902
|
+
* pipe(5, Num.inRange(1, 10)); // true
|
|
903
|
+
* pipe(1, Num.inRange(1, 10)); // true
|
|
904
|
+
* pipe(10, Num.inRange(1, 10)); // false
|
|
905
|
+
* ```
|
|
906
|
+
*/
|
|
907
|
+
const inRange: (start: number, end: number) => (n: number) => boolean;
|
|
896
908
|
/**
|
|
897
909
|
* Parses a string as a number. Returns `None` when the result is `NaN`.
|
|
898
910
|
*
|
|
@@ -1215,7 +1227,7 @@ declare namespace Rec {
|
|
|
1215
1227
|
*
|
|
1216
1228
|
* @example
|
|
1217
1229
|
* ```ts
|
|
1218
|
-
* import { Str } from "@nlozgachev/pipelined/
|
|
1230
|
+
* import { Str } from "@nlozgachev/pipelined/data";
|
|
1219
1231
|
* import { pipe } from "@nlozgachev/pipelined/composition";
|
|
1220
1232
|
*
|
|
1221
1233
|
* pipe(" Hello, World! ", Str.trim, Str.toLowerCase); // "hello, world!"
|
|
@@ -1443,7 +1455,7 @@ declare namespace Str {
|
|
|
1443
1455
|
*
|
|
1444
1456
|
* @example
|
|
1445
1457
|
* ```ts
|
|
1446
|
-
* import { Uniq } from "@nlozgachev/pipelined/
|
|
1458
|
+
* import { Uniq } from "@nlozgachev/pipelined/data";
|
|
1447
1459
|
* import { pipe } from "@nlozgachev/pipelined/composition";
|
|
1448
1460
|
*
|
|
1449
1461
|
* const active = pipe(
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { M as Maybe, R as Result, E as Equality, b as Ordering, T as Task } from './Task-
|
|
1
|
+
import { M as Maybe, R as Result, E as Equality, b as Ordering, T as Task } from './Task-Dt3ZMen6.js';
|
|
2
2
|
import { NonEmptyList } from './types.js';
|
|
3
|
+
import './Duration-BTeT9D-q.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Functional array utilities that compose well with pipe.
|
|
@@ -523,7 +524,7 @@ declare namespace Arr {
|
|
|
523
524
|
*
|
|
524
525
|
* @example
|
|
525
526
|
* ```ts
|
|
526
|
-
* import { Dict } from "@nlozgachev/pipelined/
|
|
527
|
+
* import { Dict } from "@nlozgachev/pipelined/data";
|
|
527
528
|
* import { pipe } from "@nlozgachev/pipelined/composition";
|
|
528
529
|
*
|
|
529
530
|
* const scores = pipe(
|
|
@@ -844,7 +845,7 @@ declare namespace Dict {
|
|
|
844
845
|
*
|
|
845
846
|
* @example
|
|
846
847
|
* ```ts
|
|
847
|
-
* import { Num } from "@nlozgachev/pipelined/
|
|
848
|
+
* import { Num } from "@nlozgachev/pipelined/data";
|
|
848
849
|
* import { pipe } from "@nlozgachev/pipelined/composition";
|
|
849
850
|
*
|
|
850
851
|
* pipe(
|
|
@@ -893,6 +894,17 @@ declare namespace Num {
|
|
|
893
894
|
* ```
|
|
894
895
|
*/
|
|
895
896
|
const between: (min: number, max: number) => (n: number) => boolean;
|
|
897
|
+
/**
|
|
898
|
+
* Returns `true` when the number is in the range `[start, end)` (inclusive of `start`, exclusive of `end`).
|
|
899
|
+
*
|
|
900
|
+
* @example
|
|
901
|
+
* ```ts
|
|
902
|
+
* pipe(5, Num.inRange(1, 10)); // true
|
|
903
|
+
* pipe(1, Num.inRange(1, 10)); // true
|
|
904
|
+
* pipe(10, Num.inRange(1, 10)); // false
|
|
905
|
+
* ```
|
|
906
|
+
*/
|
|
907
|
+
const inRange: (start: number, end: number) => (n: number) => boolean;
|
|
896
908
|
/**
|
|
897
909
|
* Parses a string as a number. Returns `None` when the result is `NaN`.
|
|
898
910
|
*
|
|
@@ -1215,7 +1227,7 @@ declare namespace Rec {
|
|
|
1215
1227
|
*
|
|
1216
1228
|
* @example
|
|
1217
1229
|
* ```ts
|
|
1218
|
-
* import { Str } from "@nlozgachev/pipelined/
|
|
1230
|
+
* import { Str } from "@nlozgachev/pipelined/data";
|
|
1219
1231
|
* import { pipe } from "@nlozgachev/pipelined/composition";
|
|
1220
1232
|
*
|
|
1221
1233
|
* pipe(" Hello, World! ", Str.trim, Str.toLowerCase); // "hello, world!"
|
|
@@ -1443,7 +1455,7 @@ declare namespace Str {
|
|
|
1443
1455
|
*
|
|
1444
1456
|
* @example
|
|
1445
1457
|
* ```ts
|
|
1446
|
-
* import { Uniq } from "@nlozgachev/pipelined/
|
|
1458
|
+
* import { Uniq } from "@nlozgachev/pipelined/data";
|
|
1447
1459
|
* import { pipe } from "@nlozgachev/pipelined/composition";
|
|
1448
1460
|
*
|
|
1449
1461
|
* const active = pipe(
|
package/dist/utils.js
CHANGED
|
@@ -17,9 +17,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// src/
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
20
|
+
// src/Data/index.ts
|
|
21
|
+
var Data_exports = {};
|
|
22
|
+
__export(Data_exports, {
|
|
23
23
|
Arr: () => Arr,
|
|
24
24
|
Dict: () => Dict,
|
|
25
25
|
Num: () => Num,
|
|
@@ -27,7 +27,7 @@ __export(Utils_exports, {
|
|
|
27
27
|
Str: () => Str,
|
|
28
28
|
Uniq: () => Uniq
|
|
29
29
|
});
|
|
30
|
-
module.exports = __toCommonJS(
|
|
30
|
+
module.exports = __toCommonJS(Data_exports);
|
|
31
31
|
|
|
32
32
|
// src/Core/Deferred.ts
|
|
33
33
|
var Deferred;
|
|
@@ -400,14 +400,14 @@ var Task;
|
|
|
400
400
|
};
|
|
401
401
|
return { task, abort };
|
|
402
402
|
};
|
|
403
|
-
Task2.run = (signal) => (task) =>
|
|
403
|
+
Task2.run = (signal) => (task) => task(signal);
|
|
404
404
|
Task2.bindTo = (key) => (data) => (0, Task2.map)((a) => ({ [key]: a }))(data);
|
|
405
405
|
Task2.bind = (key, f) => (data) => (0, Task2.chain)(
|
|
406
406
|
(a) => (0, Task2.map)((b) => ({ ...a, [key]: b }))(f(a))
|
|
407
407
|
)(data);
|
|
408
408
|
})(Task || (Task = {}));
|
|
409
409
|
|
|
410
|
-
// src/
|
|
410
|
+
// src/Data/Arr.ts
|
|
411
411
|
var Arr;
|
|
412
412
|
((Arr2) => {
|
|
413
413
|
Arr2.head = (data) => data.length > 0 ? Maybe.some(data[0]) : Maybe.none();
|
|
@@ -739,7 +739,7 @@ var Arr;
|
|
|
739
739
|
};
|
|
740
740
|
})(Arr || (Arr = {}));
|
|
741
741
|
|
|
742
|
-
// src/
|
|
742
|
+
// src/Data/Dict.ts
|
|
743
743
|
var Dict;
|
|
744
744
|
((Dict2) => {
|
|
745
745
|
Dict2.empty = () => new globalThis.Map();
|
|
@@ -877,7 +877,7 @@ var Dict;
|
|
|
877
877
|
Dict2.toRecord = (m) => Object.fromEntries(m);
|
|
878
878
|
})(Dict || (Dict = {}));
|
|
879
879
|
|
|
880
|
-
// src/
|
|
880
|
+
// src/Data/Num.ts
|
|
881
881
|
var Num;
|
|
882
882
|
((Num2) => {
|
|
883
883
|
Num2.range = (from, to, step = 1) => {
|
|
@@ -893,6 +893,7 @@ var Num;
|
|
|
893
893
|
};
|
|
894
894
|
Num2.clamp = (min2, max2) => (n) => Math.min(Math.max(n, min2), max2);
|
|
895
895
|
Num2.between = (min2, max2) => (n) => n >= min2 && n <= max2;
|
|
896
|
+
Num2.inRange = (start, end) => (n) => n >= start && n < end;
|
|
896
897
|
Num2.parse = (s) => {
|
|
897
898
|
if (s.trim() === "") {
|
|
898
899
|
return Maybe.none();
|
|
@@ -944,7 +945,7 @@ var Num;
|
|
|
944
945
|
};
|
|
945
946
|
})(Num || (Num = {}));
|
|
946
947
|
|
|
947
|
-
// src/
|
|
948
|
+
// src/Data/Rec.ts
|
|
948
949
|
var Rec;
|
|
949
950
|
((Rec2) => {
|
|
950
951
|
Rec2.map = (f) => (data) => {
|
|
@@ -1072,7 +1073,7 @@ var Rec;
|
|
|
1072
1073
|
};
|
|
1073
1074
|
})(Rec || (Rec = {}));
|
|
1074
1075
|
|
|
1075
|
-
// src/
|
|
1076
|
+
// src/Data/Str.ts
|
|
1076
1077
|
var Str;
|
|
1077
1078
|
((Str2) => {
|
|
1078
1079
|
Str2.split = (separator) => (s) => s.split(separator);
|
|
@@ -1132,7 +1133,7 @@ var Str;
|
|
|
1132
1133
|
};
|
|
1133
1134
|
})(Str || (Str = {}));
|
|
1134
1135
|
|
|
1135
|
-
// src/
|
|
1136
|
+
// src/Data/Uniq.ts
|
|
1136
1137
|
var Uniq;
|
|
1137
1138
|
((Uniq2) => {
|
|
1138
1139
|
Uniq2.empty = () => new globalThis.Set();
|
package/dist/utils.mjs
CHANGED
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
Rec,
|
|
6
6
|
Str,
|
|
7
7
|
Uniq
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-V37OUM35.mjs";
|
|
9
|
+
import "./chunk-COGQKPIP.mjs";
|
|
10
|
+
import "./chunk-GBB6LVLI.mjs";
|
|
11
11
|
export {
|
|
12
12
|
Arr,
|
|
13
13
|
Dict,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nlozgachev/pipelined",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "Opinionated functional abstractions for TypeScript",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"homepage": "https://pipelined.lozgachev.dev",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
],
|
|
26
26
|
"imports": {
|
|
27
27
|
"#core": "./src/Core/index.ts",
|
|
28
|
-
"#
|
|
28
|
+
"#data": "./src/Data/index.ts",
|
|
29
29
|
"#types": "./src/Types/index.ts",
|
|
30
30
|
"#composition": "./src/Composition/index.ts",
|
|
31
31
|
"#internal": "./src/internal/index.ts"
|