@nlozgachev/pipelined 0.53.0 → 0.55.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/{InternalTypes-CDiDBAY4.d.mts → InternalTypes-DuK_XpTi.d.cts} +1 -1
- package/dist/{Validation-CvCuj9D2.d.mts → Validation-CbU7Z-kj.d.cts} +85 -94
- package/dist/{Validation-wDL4nEcO.d.ts → Validation-CmxZ3V4r.d.ts} +82 -91
- package/dist/{chunk-5OFVS5UZ.mjs → chunk-JSG7SFXS.js} +1 -1
- package/dist/{chunk-XFE3SQEE.mjs → chunk-MFJXL6J2.js} +53 -62
- package/dist/{chunk-L6GLADRU.mjs → chunk-NIE7VVZU.js} +4 -5
- package/dist/composition.cjs +533 -0
- package/dist/{composition.d.mts → composition.d.cts} +2 -2
- package/dist/composition.js +35 -503
- package/dist/core.cjs +2678 -0
- package/dist/{core.d.mts → core.d.cts} +12 -12
- package/dist/core.d.ts +9 -9
- package/dist/core.js +27 -2665
- package/dist/data.cjs +1612 -0
- package/dist/{data.d.mts → data.d.cts} +4 -4
- package/dist/data.d.ts +1 -1
- package/dist/data.js +14 -2137
- package/dist/index.cjs +4508 -0
- package/dist/{index.d.mts → index.d.cts} +7 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +73 -4454
- package/dist/types.cjs +84 -0
- package/dist/{types.d.mts → types.d.cts} +2 -2
- package/dist/types.js +7 -81
- package/package.json +2 -1
- package/dist/composition.mjs +0 -65
- package/dist/core.mjs +0 -49
- package/dist/data.mjs +0 -22
- package/dist/index.mjs +0 -136
- package/dist/types.mjs +0 -10
- /package/dist/{Duration-B8joKzro.d.mts → Duration-B8joKzro.d.cts} +0 -0
- /package/dist/{chunk-DENXUTKL.mjs → chunk-OIIOGDHK.js} +0 -0
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/Composition/index.ts
|
|
21
|
+
var Composition_exports = {};
|
|
22
|
+
__export(Composition_exports, {
|
|
23
|
+
and: () => and,
|
|
24
|
+
compose: () => compose,
|
|
25
|
+
constFalse: () => constFalse,
|
|
26
|
+
constNull: () => constNull,
|
|
27
|
+
constTrue: () => constTrue,
|
|
28
|
+
constUndefined: () => constUndefined,
|
|
29
|
+
constVoid: () => constVoid,
|
|
30
|
+
constant: () => constant,
|
|
31
|
+
converge: () => converge,
|
|
32
|
+
curry: () => curry,
|
|
33
|
+
curry3: () => curry3,
|
|
34
|
+
curry4: () => curry4,
|
|
35
|
+
defaultTo: () => defaultTo,
|
|
36
|
+
flip: () => flip,
|
|
37
|
+
flow: () => flow,
|
|
38
|
+
identity: () => identity,
|
|
39
|
+
juxt: () => juxt,
|
|
40
|
+
memoize: () => memoize,
|
|
41
|
+
memoizeWeak: () => memoizeWeak,
|
|
42
|
+
not: () => not,
|
|
43
|
+
on: () => on,
|
|
44
|
+
once: () => once,
|
|
45
|
+
or: () => or,
|
|
46
|
+
pipe: () => pipe,
|
|
47
|
+
tap: () => tap,
|
|
48
|
+
tuple: () => tuple,
|
|
49
|
+
uncurry: () => uncurry,
|
|
50
|
+
uncurry3: () => uncurry3,
|
|
51
|
+
uncurry4: () => uncurry4,
|
|
52
|
+
untuple: () => untuple
|
|
53
|
+
});
|
|
54
|
+
module.exports = __toCommonJS(Composition_exports);
|
|
55
|
+
|
|
56
|
+
// src/Composition/compose.ts
|
|
57
|
+
function compose(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9) {
|
|
58
|
+
const len = arguments.length;
|
|
59
|
+
switch (len) {
|
|
60
|
+
case 1: {
|
|
61
|
+
return f0;
|
|
62
|
+
}
|
|
63
|
+
case 2: {
|
|
64
|
+
return function() {
|
|
65
|
+
return f0(f1.apply(this, arguments));
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
case 3: {
|
|
69
|
+
return function() {
|
|
70
|
+
return f0(f1(f2.apply(this, arguments)));
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
case 4: {
|
|
74
|
+
return function() {
|
|
75
|
+
return f0(f1(f2(f3.apply(this, arguments))));
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
case 5: {
|
|
79
|
+
return function() {
|
|
80
|
+
return f0(f1(f2(f3(f4.apply(this, arguments)))));
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
case 6: {
|
|
84
|
+
return function() {
|
|
85
|
+
return f0(f1(f2(f3(f4(f5.apply(this, arguments))))));
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
case 7: {
|
|
89
|
+
return function() {
|
|
90
|
+
return f0(f1(f2(f3(f4(f5(f6.apply(this, arguments)))))));
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
case 8: {
|
|
94
|
+
return function() {
|
|
95
|
+
return f0(f1(f2(f3(f4(f5(f6(f7.apply(this, arguments))))))));
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
case 9: {
|
|
99
|
+
return function() {
|
|
100
|
+
return f0(f1(f2(f3(f4(f5(f6(f7(f8.apply(this, arguments)))))))));
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
case 10: {
|
|
104
|
+
return function() {
|
|
105
|
+
return f0(f1(f2(f3(f4(f5(f6(f7(f8(f9.apply(this, arguments))))))))));
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// src/Composition/converge.ts
|
|
112
|
+
function converge(f, transformers) {
|
|
113
|
+
return (a) => f(...transformers.map((t) => t(a)));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// src/Composition/curry.ts
|
|
117
|
+
var curry = (f) => (a) => (b) => f(a, b);
|
|
118
|
+
var curry3 = (f) => (a) => (b) => (c) => f(a, b, c);
|
|
119
|
+
var curry4 = (f) => (a) => (b) => (c) => (d) => f(a, b, c, d);
|
|
120
|
+
|
|
121
|
+
// src/Composition/flip.ts
|
|
122
|
+
var flip = (f) => (b) => (a) => f(a)(b);
|
|
123
|
+
|
|
124
|
+
// src/Composition/flow.ts
|
|
125
|
+
function flow(ab, bc, cd, de, ef, fg, gh, hi, ij, jk) {
|
|
126
|
+
const len = arguments.length;
|
|
127
|
+
switch (len) {
|
|
128
|
+
case 0: {
|
|
129
|
+
return function(...args) {
|
|
130
|
+
return args[0];
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
case 1: {
|
|
134
|
+
return ab;
|
|
135
|
+
}
|
|
136
|
+
case 2: {
|
|
137
|
+
return function() {
|
|
138
|
+
return bc(ab.apply(this, arguments));
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
case 3: {
|
|
142
|
+
return function() {
|
|
143
|
+
return cd(bc(ab.apply(this, arguments)));
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
case 4: {
|
|
147
|
+
return function() {
|
|
148
|
+
return de(cd(bc(ab.apply(this, arguments))));
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
case 5: {
|
|
152
|
+
return function() {
|
|
153
|
+
return ef(de(cd(bc(ab.apply(this, arguments)))));
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
case 6: {
|
|
157
|
+
return function() {
|
|
158
|
+
return fg(ef(de(cd(bc(ab.apply(this, arguments))))));
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
case 7: {
|
|
162
|
+
return function() {
|
|
163
|
+
return gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))));
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
case 8: {
|
|
167
|
+
return function() {
|
|
168
|
+
return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))));
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
case 9: {
|
|
172
|
+
return function() {
|
|
173
|
+
return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))));
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
case 10: {
|
|
177
|
+
return function() {
|
|
178
|
+
return jk(ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))))));
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
var when = (predicate, onTrue) => (a) => predicate(a) ? onTrue(a) : a;
|
|
184
|
+
var unless = (predicate, onFalse) => (a) => predicate(a) ? a : onFalse(a);
|
|
185
|
+
var either = (predicate, onTrue, onFalse) => (a) => predicate(a) ? onTrue(a) : onFalse(a);
|
|
186
|
+
var struct = (fields) => (a) => {
|
|
187
|
+
const result = {};
|
|
188
|
+
for (const key of Object.keys(fields)) {
|
|
189
|
+
result[key] = fields[key](a);
|
|
190
|
+
}
|
|
191
|
+
return result;
|
|
192
|
+
};
|
|
193
|
+
function safe(...fns) {
|
|
194
|
+
return (a) => {
|
|
195
|
+
let result = a;
|
|
196
|
+
if (result === null || result === void 0) {
|
|
197
|
+
return result;
|
|
198
|
+
}
|
|
199
|
+
for (const fn of fns) {
|
|
200
|
+
result = fn(result);
|
|
201
|
+
if (result === null || result === void 0) {
|
|
202
|
+
return result;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return result;
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function async(...fns) {
|
|
209
|
+
return async (a) => {
|
|
210
|
+
let result = await a;
|
|
211
|
+
for (const fn of fns) {
|
|
212
|
+
result = await fn(result);
|
|
213
|
+
}
|
|
214
|
+
return result;
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
flow.when = when;
|
|
218
|
+
flow.unless = unless;
|
|
219
|
+
flow.either = either;
|
|
220
|
+
flow.struct = struct;
|
|
221
|
+
flow.safe = safe;
|
|
222
|
+
flow.async = async;
|
|
223
|
+
flow.try = (f, onError) => (a) => {
|
|
224
|
+
try {
|
|
225
|
+
return f(a);
|
|
226
|
+
} catch (error) {
|
|
227
|
+
return onError(error, a);
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
// src/Composition/fn.ts
|
|
232
|
+
var identity = (a) => a;
|
|
233
|
+
var constant = (a) => () => a;
|
|
234
|
+
var constTrue = () => true;
|
|
235
|
+
var constFalse = () => false;
|
|
236
|
+
var constNull = () => null;
|
|
237
|
+
var constUndefined = () => void 0;
|
|
238
|
+
var constVoid = () => {
|
|
239
|
+
};
|
|
240
|
+
var and = (p1, p2) => (...args) => p1(...args) && p2(...args);
|
|
241
|
+
var or = (p1, p2) => (...args) => p1(...args) || p2(...args);
|
|
242
|
+
var once = (f) => {
|
|
243
|
+
let called = false;
|
|
244
|
+
let result;
|
|
245
|
+
return () => {
|
|
246
|
+
if (!called) {
|
|
247
|
+
result = f();
|
|
248
|
+
called = true;
|
|
249
|
+
}
|
|
250
|
+
return result;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
var defaultTo = (fallback) => (a) => a === null || a === void 0 ? fallback : a;
|
|
254
|
+
var tuple = (f) => (args) => f(...args);
|
|
255
|
+
var untuple = (f) => (...args) => f(args);
|
|
256
|
+
|
|
257
|
+
// src/Composition/juxt.ts
|
|
258
|
+
function juxt(fns) {
|
|
259
|
+
return (a) => fns.map((f) => f(a));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// src/Composition/memoize.ts
|
|
263
|
+
var memoize = (f, options) => {
|
|
264
|
+
const cache = /* @__PURE__ */ new Map();
|
|
265
|
+
const keyFn = options?.key ?? ((a) => a);
|
|
266
|
+
return (a) => {
|
|
267
|
+
const key = keyFn(a);
|
|
268
|
+
if (cache.has(key)) {
|
|
269
|
+
return cache.get(key);
|
|
270
|
+
}
|
|
271
|
+
const result = f(a);
|
|
272
|
+
cache.set(key, result);
|
|
273
|
+
return result;
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
var memoizeWeak = (f) => {
|
|
277
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
278
|
+
return (a) => {
|
|
279
|
+
if (cache.has(a)) {
|
|
280
|
+
return cache.get(a);
|
|
281
|
+
}
|
|
282
|
+
const result = f(a);
|
|
283
|
+
cache.set(a, result);
|
|
284
|
+
return result;
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
// src/Composition/not.ts
|
|
289
|
+
var not = (predicate) => (...args) => !predicate(...args);
|
|
290
|
+
|
|
291
|
+
// src/Composition/on.ts
|
|
292
|
+
var on = (f, g) => (a, b) => f(g(a), g(b));
|
|
293
|
+
|
|
294
|
+
// src/Composition/pipe.ts
|
|
295
|
+
function pipe(a, ab, bc, cd, de, ef, fg, gh, hi, ij, jk) {
|
|
296
|
+
switch (arguments.length) {
|
|
297
|
+
case 1: {
|
|
298
|
+
return a;
|
|
299
|
+
}
|
|
300
|
+
case 2: {
|
|
301
|
+
return ab(a);
|
|
302
|
+
}
|
|
303
|
+
case 3: {
|
|
304
|
+
return bc(ab(a));
|
|
305
|
+
}
|
|
306
|
+
case 4: {
|
|
307
|
+
return cd(bc(ab(a)));
|
|
308
|
+
}
|
|
309
|
+
case 5: {
|
|
310
|
+
return de(cd(bc(ab(a))));
|
|
311
|
+
}
|
|
312
|
+
case 6: {
|
|
313
|
+
return ef(de(cd(bc(ab(a)))));
|
|
314
|
+
}
|
|
315
|
+
case 7: {
|
|
316
|
+
return fg(ef(de(cd(bc(ab(a))))));
|
|
317
|
+
}
|
|
318
|
+
case 8: {
|
|
319
|
+
return gh(fg(ef(de(cd(bc(ab(a)))))));
|
|
320
|
+
}
|
|
321
|
+
case 9: {
|
|
322
|
+
return hi(gh(fg(ef(de(cd(bc(ab(a))))))));
|
|
323
|
+
}
|
|
324
|
+
case 10: {
|
|
325
|
+
return ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))));
|
|
326
|
+
}
|
|
327
|
+
case 11: {
|
|
328
|
+
return jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))));
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
var when2 = (predicate, onTrue) => (a) => predicate(a) ? onTrue(a) : a;
|
|
333
|
+
var unless2 = (predicate, onFalse) => (a) => predicate(a) ? a : onFalse(a);
|
|
334
|
+
var either2 = (predicate, onTrue, onFalse) => (a) => predicate(a) ? onTrue(a) : onFalse(a);
|
|
335
|
+
var struct2 = (fields) => (a) => {
|
|
336
|
+
const result = {};
|
|
337
|
+
for (const key of Object.keys(fields)) {
|
|
338
|
+
result[key] = fields[key](a);
|
|
339
|
+
}
|
|
340
|
+
return result;
|
|
341
|
+
};
|
|
342
|
+
function safe2(a, ...fns) {
|
|
343
|
+
let result = a;
|
|
344
|
+
if (result === null || result === void 0) {
|
|
345
|
+
return result;
|
|
346
|
+
}
|
|
347
|
+
for (const fn of fns) {
|
|
348
|
+
result = fn(result);
|
|
349
|
+
if (result === null || result === void 0) {
|
|
350
|
+
return result;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return result;
|
|
354
|
+
}
|
|
355
|
+
async function async2(a, ...fns) {
|
|
356
|
+
let result = await a;
|
|
357
|
+
for (const fn of fns) {
|
|
358
|
+
result = await fn(result);
|
|
359
|
+
}
|
|
360
|
+
return result;
|
|
361
|
+
}
|
|
362
|
+
pipe.when = when2;
|
|
363
|
+
pipe.unless = unless2;
|
|
364
|
+
pipe.either = either2;
|
|
365
|
+
pipe.struct = struct2;
|
|
366
|
+
pipe.safe = safe2;
|
|
367
|
+
pipe.async = async2;
|
|
368
|
+
pipe.try = (f, onError) => (a) => {
|
|
369
|
+
try {
|
|
370
|
+
return f(a);
|
|
371
|
+
} catch (error) {
|
|
372
|
+
return onError(error, a);
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
// src/Composition/tap.ts
|
|
377
|
+
var import_node_util = require("util");
|
|
378
|
+
|
|
379
|
+
// src/Types/Brand.ts
|
|
380
|
+
var Brand;
|
|
381
|
+
((Brand2) => {
|
|
382
|
+
Brand2.wrap = () => (value) => value;
|
|
383
|
+
Brand2.unwrap = (branded) => branded;
|
|
384
|
+
})(Brand || (Brand = {}));
|
|
385
|
+
|
|
386
|
+
// src/Types/Duration.ts
|
|
387
|
+
var Duration;
|
|
388
|
+
((Duration2) => {
|
|
389
|
+
const wrap = Brand.wrap();
|
|
390
|
+
Duration2.milliseconds = (ms) => wrap(ms);
|
|
391
|
+
Duration2.seconds = (s) => wrap(s * 1e3);
|
|
392
|
+
Duration2.minutes = (m) => wrap(m * 60 * 1e3);
|
|
393
|
+
Duration2.hours = (h) => wrap(h * 60 * 60 * 1e3);
|
|
394
|
+
Duration2.days = (d) => wrap(d * 24 * 60 * 60 * 1e3);
|
|
395
|
+
let to;
|
|
396
|
+
((to2) => {
|
|
397
|
+
to2.milliseconds = (d) => Brand.unwrap(d);
|
|
398
|
+
to2.seconds = (d) => Brand.unwrap(d) / 1e3;
|
|
399
|
+
to2.minutes = (d) => Brand.unwrap(d) / (60 * 1e3);
|
|
400
|
+
to2.hours = (d) => Brand.unwrap(d) / (60 * 60 * 1e3);
|
|
401
|
+
to2.days = (d) => Brand.unwrap(d) / (24 * 60 * 60 * 1e3);
|
|
402
|
+
})(to = Duration2.to || (Duration2.to = {}));
|
|
403
|
+
Duration2.add = (other) => (self) => wrap(Brand.unwrap(self) + Brand.unwrap(other));
|
|
404
|
+
Duration2.subtract = (other) => (self) => wrap(Brand.unwrap(self) - Brand.unwrap(other));
|
|
405
|
+
})(Duration || (Duration = {}));
|
|
406
|
+
|
|
407
|
+
// src/Composition/tap.ts
|
|
408
|
+
function tap(f) {
|
|
409
|
+
return (a) => {
|
|
410
|
+
f(a);
|
|
411
|
+
return a;
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
((tap2) => {
|
|
415
|
+
tap2.log = (options) => (a) => {
|
|
416
|
+
const logger = options?.logger ?? console.log;
|
|
417
|
+
const formatter = options?.formatter ?? ((val) => {
|
|
418
|
+
try {
|
|
419
|
+
return typeof val === "object" && val !== null ? JSON.stringify(val) : String(val);
|
|
420
|
+
} catch {
|
|
421
|
+
return String(val);
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
const formatted = formatter(a);
|
|
425
|
+
if (options?.label !== void 0) {
|
|
426
|
+
logger(`[${options.label}]: ${formatted}`);
|
|
427
|
+
} else {
|
|
428
|
+
logger(formatted);
|
|
429
|
+
}
|
|
430
|
+
return a;
|
|
431
|
+
};
|
|
432
|
+
tap2.inspect = (options) => (a) => {
|
|
433
|
+
const label = options?.label;
|
|
434
|
+
const depth = options?.depth ?? null;
|
|
435
|
+
const colors = options?.colors ?? true;
|
|
436
|
+
let formatted;
|
|
437
|
+
if (typeof import_node_util.inspect === "function") {
|
|
438
|
+
formatted = (0, import_node_util.inspect)(a, { depth, colors });
|
|
439
|
+
} else {
|
|
440
|
+
try {
|
|
441
|
+
formatted = JSON.stringify(a, null, 2);
|
|
442
|
+
} catch {
|
|
443
|
+
formatted = String(a);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
if (label !== void 0) {
|
|
447
|
+
console.log(`[${label}]: ${formatted}`);
|
|
448
|
+
} else {
|
|
449
|
+
console.log(formatted);
|
|
450
|
+
}
|
|
451
|
+
return a;
|
|
452
|
+
};
|
|
453
|
+
tap2.async = (fn, options) => (a) => {
|
|
454
|
+
const onError = options?.onError ?? console.error;
|
|
455
|
+
Promise.resolve(fn(a)).catch((err) => {
|
|
456
|
+
onError(err);
|
|
457
|
+
});
|
|
458
|
+
return a;
|
|
459
|
+
};
|
|
460
|
+
tap2.time = (fn, config) => (a) => {
|
|
461
|
+
const start = performance.now();
|
|
462
|
+
const triggerFinish = (duration) => {
|
|
463
|
+
if (config.label !== void 0) {
|
|
464
|
+
console.log(`[${config.label}]: ${Duration.to.milliseconds(duration)}ms`);
|
|
465
|
+
} else {
|
|
466
|
+
config.onFinish(duration);
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
try {
|
|
470
|
+
const res = fn(a);
|
|
471
|
+
if (res !== null && (typeof res === "object" || typeof res === "function") && typeof res.then === "function") {
|
|
472
|
+
res.then(() => {
|
|
473
|
+
const duration = Duration.milliseconds(performance.now() - start);
|
|
474
|
+
triggerFinish(duration);
|
|
475
|
+
}, () => {
|
|
476
|
+
const duration = Duration.milliseconds(performance.now() - start);
|
|
477
|
+
triggerFinish(duration);
|
|
478
|
+
});
|
|
479
|
+
} else {
|
|
480
|
+
const duration = Duration.milliseconds(performance.now() - start);
|
|
481
|
+
triggerFinish(duration);
|
|
482
|
+
}
|
|
483
|
+
} catch (err) {
|
|
484
|
+
const duration = Duration.milliseconds(performance.now() - start);
|
|
485
|
+
triggerFinish(duration);
|
|
486
|
+
throw err;
|
|
487
|
+
}
|
|
488
|
+
return a;
|
|
489
|
+
};
|
|
490
|
+
})(tap || (tap = {}));
|
|
491
|
+
|
|
492
|
+
// src/Composition/uncurry.ts
|
|
493
|
+
function uncurry(f) {
|
|
494
|
+
return (...args) => {
|
|
495
|
+
const inner = f(...args.slice(0, f.length));
|
|
496
|
+
return inner.length === 0 ? inner() : inner(...args.slice(f.length));
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
var uncurry3 = (f) => (a, b, c) => f(a)(b)(c);
|
|
500
|
+
var uncurry4 = (f) => (a, b, c, d) => f(a)(b)(c)(d);
|
|
501
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
502
|
+
0 && (module.exports = {
|
|
503
|
+
and,
|
|
504
|
+
compose,
|
|
505
|
+
constFalse,
|
|
506
|
+
constNull,
|
|
507
|
+
constTrue,
|
|
508
|
+
constUndefined,
|
|
509
|
+
constVoid,
|
|
510
|
+
constant,
|
|
511
|
+
converge,
|
|
512
|
+
curry,
|
|
513
|
+
curry3,
|
|
514
|
+
curry4,
|
|
515
|
+
defaultTo,
|
|
516
|
+
flip,
|
|
517
|
+
flow,
|
|
518
|
+
identity,
|
|
519
|
+
juxt,
|
|
520
|
+
memoize,
|
|
521
|
+
memoizeWeak,
|
|
522
|
+
not,
|
|
523
|
+
on,
|
|
524
|
+
once,
|
|
525
|
+
or,
|
|
526
|
+
pipe,
|
|
527
|
+
tap,
|
|
528
|
+
tuple,
|
|
529
|
+
uncurry,
|
|
530
|
+
uncurry3,
|
|
531
|
+
uncurry4,
|
|
532
|
+
untuple
|
|
533
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as Awaitable, T as Thenable } from './InternalTypes-
|
|
2
|
-
import { D as Duration } from './Duration-B8joKzro.
|
|
1
|
+
import { A as Awaitable, T as Thenable } from './InternalTypes-DuK_XpTi.cjs';
|
|
2
|
+
import { D as Duration } from './Duration-B8joKzro.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Composes functions from right to left, returning a new function.
|