@nlozgachev/pipelined 0.40.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/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-BQKKTTJS.mjs → chunk-V37OUM35.mjs} +3 -2
- 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 +117 -34
- 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 +13 -1
- package/dist/utils.d.ts +13 -1
- package/dist/utils.js +2 -1
- package/dist/utils.mjs +3 -3
- package/package.json +1 -1
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.
|
|
@@ -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
|
*
|
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.
|
|
@@ -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
|
*
|
package/dist/utils.js
CHANGED
|
@@ -400,7 +400,7 @@ 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))
|
|
@@ -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();
|
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,
|