@nlozgachev/pipelined 0.57.0 → 0.58.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/{chunk-M4JSQLML.js → chunk-FVWJMPQI.js} +1 -1
- package/dist/{chunk-YMHKIN4I.js → chunk-VYHAA4KO.js} +29 -29
- package/dist/core.cjs +30 -30
- package/dist/core.d.cts +143 -143
- package/dist/core.d.ts +143 -143
- package/dist/core.js +3 -3
- package/dist/data.js +2 -2
- package/dist/index.cjs +30 -30
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/package.json +1 -1
|
@@ -1402,6 +1402,34 @@ var Ordering;
|
|
|
1402
1402
|
};
|
|
1403
1403
|
})(Ordering || (Ordering = {}));
|
|
1404
1404
|
|
|
1405
|
+
// src/Core/Pair.ts
|
|
1406
|
+
var Pair;
|
|
1407
|
+
((Pair2) => {
|
|
1408
|
+
let from;
|
|
1409
|
+
((from2) => {
|
|
1410
|
+
from2.pair = (first2, second2) => [first2, second2];
|
|
1411
|
+
from2.array = (arr) => arr;
|
|
1412
|
+
})(from = Pair2.from || (Pair2.from = {}));
|
|
1413
|
+
Pair2.first = (p) => p[0];
|
|
1414
|
+
Pair2.second = (p) => p[1];
|
|
1415
|
+
Pair2.mapFirst = (f) => (p) => [f(p[0]), p[1]];
|
|
1416
|
+
Pair2.mapSecond = (f) => (p) => [p[0], f(p[1])];
|
|
1417
|
+
Pair2.mapBoth = (onFirst, onSecond) => (p) => [
|
|
1418
|
+
onFirst(p[0]),
|
|
1419
|
+
onSecond(p[1])
|
|
1420
|
+
];
|
|
1421
|
+
Pair2.fold = (f) => (p) => f(p[0], p[1]);
|
|
1422
|
+
Pair2.swap = (p) => [p[1], p[0]];
|
|
1423
|
+
let to;
|
|
1424
|
+
((to2) => {
|
|
1425
|
+
to2.Array = (p) => [...p];
|
|
1426
|
+
})(to = Pair2.to || (Pair2.to = {}));
|
|
1427
|
+
Pair2.tap = (f) => (p) => {
|
|
1428
|
+
f(p[0], p[1]);
|
|
1429
|
+
return p;
|
|
1430
|
+
};
|
|
1431
|
+
})(Pair || (Pair = {}));
|
|
1432
|
+
|
|
1405
1433
|
// src/Core/Predicate.ts
|
|
1406
1434
|
var Predicate;
|
|
1407
1435
|
((Predicate2) => {
|
|
@@ -2460,34 +2488,6 @@ var These;
|
|
|
2460
2488
|
};
|
|
2461
2489
|
})(These || (These = {}));
|
|
2462
2490
|
|
|
2463
|
-
// src/Core/Tuple.ts
|
|
2464
|
-
var Tuple;
|
|
2465
|
-
((Tuple2) => {
|
|
2466
|
-
let from;
|
|
2467
|
-
((from2) => {
|
|
2468
|
-
from2.pair = (first2, second2) => [first2, second2];
|
|
2469
|
-
from2.array = (arr) => arr;
|
|
2470
|
-
})(from = Tuple2.from || (Tuple2.from = {}));
|
|
2471
|
-
Tuple2.first = (tuple) => tuple[0];
|
|
2472
|
-
Tuple2.second = (tuple) => tuple[1];
|
|
2473
|
-
Tuple2.mapFirst = (f) => (tuple) => [f(tuple[0]), tuple[1]];
|
|
2474
|
-
Tuple2.mapSecond = (f) => (tuple) => [tuple[0], f(tuple[1])];
|
|
2475
|
-
Tuple2.mapBoth = (onFirst, onSecond) => (tuple) => [
|
|
2476
|
-
onFirst(tuple[0]),
|
|
2477
|
-
onSecond(tuple[1])
|
|
2478
|
-
];
|
|
2479
|
-
Tuple2.fold = (f) => (tuple) => f(tuple[0], tuple[1]);
|
|
2480
|
-
Tuple2.swap = (tuple) => [tuple[1], tuple[0]];
|
|
2481
|
-
let to;
|
|
2482
|
-
((to2) => {
|
|
2483
|
-
to2.Array = (tuple) => [...tuple];
|
|
2484
|
-
})(to = Tuple2.to || (Tuple2.to = {}));
|
|
2485
|
-
Tuple2.tap = (f) => (tuple) => {
|
|
2486
|
-
f(tuple[0], tuple[1]);
|
|
2487
|
-
return tuple;
|
|
2488
|
-
};
|
|
2489
|
-
})(Tuple || (Tuple = {}));
|
|
2490
|
-
|
|
2491
2491
|
// src/Core/Validation.ts
|
|
2492
2492
|
var Validation;
|
|
2493
2493
|
((Validation2) => {
|
|
@@ -2605,6 +2605,7 @@ export {
|
|
|
2605
2605
|
Op,
|
|
2606
2606
|
Optional,
|
|
2607
2607
|
Ordering,
|
|
2608
|
+
Pair,
|
|
2608
2609
|
Predicate,
|
|
2609
2610
|
Reader,
|
|
2610
2611
|
Refinement,
|
|
@@ -2616,6 +2617,5 @@ export {
|
|
|
2616
2617
|
isNonEmptyArr,
|
|
2617
2618
|
Task,
|
|
2618
2619
|
These,
|
|
2619
|
-
Tuple,
|
|
2620
2620
|
Validation
|
|
2621
2621
|
};
|
package/dist/core.cjs
CHANGED
|
@@ -30,6 +30,7 @@ __export(Core_exports, {
|
|
|
30
30
|
Op: () => Op,
|
|
31
31
|
Optional: () => Optional,
|
|
32
32
|
Ordering: () => Ordering,
|
|
33
|
+
Pair: () => Pair,
|
|
33
34
|
Predicate: () => Predicate,
|
|
34
35
|
Reader: () => Reader,
|
|
35
36
|
Refinement: () => Refinement,
|
|
@@ -40,7 +41,6 @@ __export(Core_exports, {
|
|
|
40
41
|
Stream: () => Stream,
|
|
41
42
|
Task: () => Task,
|
|
42
43
|
These: () => These,
|
|
43
|
-
Tuple: () => Tuple,
|
|
44
44
|
Validation: () => Validation
|
|
45
45
|
});
|
|
46
46
|
module.exports = __toCommonJS(Core_exports);
|
|
@@ -1473,6 +1473,34 @@ var Ordering;
|
|
|
1473
1473
|
};
|
|
1474
1474
|
})(Ordering || (Ordering = {}));
|
|
1475
1475
|
|
|
1476
|
+
// src/Core/Pair.ts
|
|
1477
|
+
var Pair;
|
|
1478
|
+
((Pair2) => {
|
|
1479
|
+
let from;
|
|
1480
|
+
((from2) => {
|
|
1481
|
+
from2.pair = (first2, second2) => [first2, second2];
|
|
1482
|
+
from2.array = (arr) => arr;
|
|
1483
|
+
})(from = Pair2.from || (Pair2.from = {}));
|
|
1484
|
+
Pair2.first = (p) => p[0];
|
|
1485
|
+
Pair2.second = (p) => p[1];
|
|
1486
|
+
Pair2.mapFirst = (f) => (p) => [f(p[0]), p[1]];
|
|
1487
|
+
Pair2.mapSecond = (f) => (p) => [p[0], f(p[1])];
|
|
1488
|
+
Pair2.mapBoth = (onFirst, onSecond) => (p) => [
|
|
1489
|
+
onFirst(p[0]),
|
|
1490
|
+
onSecond(p[1])
|
|
1491
|
+
];
|
|
1492
|
+
Pair2.fold = (f) => (p) => f(p[0], p[1]);
|
|
1493
|
+
Pair2.swap = (p) => [p[1], p[0]];
|
|
1494
|
+
let to;
|
|
1495
|
+
((to2) => {
|
|
1496
|
+
to2.Array = (p) => [...p];
|
|
1497
|
+
})(to = Pair2.to || (Pair2.to = {}));
|
|
1498
|
+
Pair2.tap = (f) => (p) => {
|
|
1499
|
+
f(p[0], p[1]);
|
|
1500
|
+
return p;
|
|
1501
|
+
};
|
|
1502
|
+
})(Pair || (Pair = {}));
|
|
1503
|
+
|
|
1476
1504
|
// src/Core/Predicate.ts
|
|
1477
1505
|
var Predicate;
|
|
1478
1506
|
((Predicate2) => {
|
|
@@ -2531,34 +2559,6 @@ var These;
|
|
|
2531
2559
|
};
|
|
2532
2560
|
})(These || (These = {}));
|
|
2533
2561
|
|
|
2534
|
-
// src/Core/Tuple.ts
|
|
2535
|
-
var Tuple;
|
|
2536
|
-
((Tuple2) => {
|
|
2537
|
-
let from;
|
|
2538
|
-
((from2) => {
|
|
2539
|
-
from2.pair = (first2, second2) => [first2, second2];
|
|
2540
|
-
from2.array = (arr) => arr;
|
|
2541
|
-
})(from = Tuple2.from || (Tuple2.from = {}));
|
|
2542
|
-
Tuple2.first = (tuple) => tuple[0];
|
|
2543
|
-
Tuple2.second = (tuple) => tuple[1];
|
|
2544
|
-
Tuple2.mapFirst = (f) => (tuple) => [f(tuple[0]), tuple[1]];
|
|
2545
|
-
Tuple2.mapSecond = (f) => (tuple) => [tuple[0], f(tuple[1])];
|
|
2546
|
-
Tuple2.mapBoth = (onFirst, onSecond) => (tuple) => [
|
|
2547
|
-
onFirst(tuple[0]),
|
|
2548
|
-
onSecond(tuple[1])
|
|
2549
|
-
];
|
|
2550
|
-
Tuple2.fold = (f) => (tuple) => f(tuple[0], tuple[1]);
|
|
2551
|
-
Tuple2.swap = (tuple) => [tuple[1], tuple[0]];
|
|
2552
|
-
let to;
|
|
2553
|
-
((to2) => {
|
|
2554
|
-
to2.Array = (tuple) => [...tuple];
|
|
2555
|
-
})(to = Tuple2.to || (Tuple2.to = {}));
|
|
2556
|
-
Tuple2.tap = (f) => (tuple) => {
|
|
2557
|
-
f(tuple[0], tuple[1]);
|
|
2558
|
-
return tuple;
|
|
2559
|
-
};
|
|
2560
|
-
})(Tuple || (Tuple = {}));
|
|
2561
|
-
|
|
2562
2562
|
// src/Core/Validation.ts
|
|
2563
2563
|
var Validation;
|
|
2564
2564
|
((Validation2) => {
|
|
@@ -2676,6 +2676,7 @@ var Validation;
|
|
|
2676
2676
|
Op,
|
|
2677
2677
|
Optional,
|
|
2678
2678
|
Ordering,
|
|
2679
|
+
Pair,
|
|
2679
2680
|
Predicate,
|
|
2680
2681
|
Reader,
|
|
2681
2682
|
Refinement,
|
|
@@ -2686,6 +2687,5 @@ var Validation;
|
|
|
2686
2687
|
Stream,
|
|
2687
2688
|
Task,
|
|
2688
2689
|
These,
|
|
2689
|
-
Tuple,
|
|
2690
2690
|
Validation
|
|
2691
2691
|
});
|
package/dist/core.d.cts
CHANGED
|
@@ -1327,6 +1327,148 @@ declare namespace Optional {
|
|
|
1327
1327
|
const andThenLens: <A, B>(inner: Lens<A, B>) => <S>(outer: Optional<S, A>) => Optional<S, B>;
|
|
1328
1328
|
}
|
|
1329
1329
|
|
|
1330
|
+
/**
|
|
1331
|
+
* Pair<A, B> represents a pair of two values that are always both present.
|
|
1332
|
+
* It is a typed alias for `readonly [A, B]`.
|
|
1333
|
+
*
|
|
1334
|
+
* Use Pair when two values always travel together through a pipeline and you
|
|
1335
|
+
* want to transform either or both sides without destructuring.
|
|
1336
|
+
*
|
|
1337
|
+
* @example
|
|
1338
|
+
* ```ts
|
|
1339
|
+
* import { Pair } from "@nlozgachev/pipelined/core";
|
|
1340
|
+
* import { pipe } from "@nlozgachev/pipelined/composition";
|
|
1341
|
+
*
|
|
1342
|
+
* const entry = Pair.from.pair("alice", 42);
|
|
1343
|
+
*
|
|
1344
|
+
* pipe(
|
|
1345
|
+
* entry,
|
|
1346
|
+
* Pair.mapFirst((name) => name.toUpperCase()),
|
|
1347
|
+
* Pair.mapSecond((score) => score * 2),
|
|
1348
|
+
* Pair.fold((name, score) => `${name}: ${score}`),
|
|
1349
|
+
* ); // "ALICE: 84"
|
|
1350
|
+
* ```
|
|
1351
|
+
*/
|
|
1352
|
+
type Pair<A, B> = readonly [A, B];
|
|
1353
|
+
declare namespace Pair {
|
|
1354
|
+
namespace from {
|
|
1355
|
+
/**
|
|
1356
|
+
* Creates a Pair from two values.
|
|
1357
|
+
*
|
|
1358
|
+
* @example
|
|
1359
|
+
* ```ts
|
|
1360
|
+
* Pair.from.pair("Paris", 2_161_000); // ["Paris", 2161000]
|
|
1361
|
+
* ```
|
|
1362
|
+
*/
|
|
1363
|
+
const pair: <A, B>(first: A, second: B) => Pair<A, B>;
|
|
1364
|
+
/**
|
|
1365
|
+
* Creates a Pair from a two-element array.
|
|
1366
|
+
*
|
|
1367
|
+
* @example
|
|
1368
|
+
* ```ts
|
|
1369
|
+
* Pair.from.array(["Paris", 2_161_000] as const); // ["Paris", 2161000]
|
|
1370
|
+
* ```
|
|
1371
|
+
*/
|
|
1372
|
+
const array: <A, B>(arr: readonly [A, B]) => Pair<A, B>;
|
|
1373
|
+
}
|
|
1374
|
+
/**
|
|
1375
|
+
* Returns the first value from the pair.
|
|
1376
|
+
*
|
|
1377
|
+
* @example
|
|
1378
|
+
* ```ts
|
|
1379
|
+
* Pair.first(Pair.from.pair("Paris", 2_161_000)); // "Paris"
|
|
1380
|
+
* ```
|
|
1381
|
+
*/
|
|
1382
|
+
const first: <A, B>(p: Pair<A, B>) => A;
|
|
1383
|
+
/**
|
|
1384
|
+
* Returns the second value from the pair.
|
|
1385
|
+
*
|
|
1386
|
+
* @example
|
|
1387
|
+
* ```ts
|
|
1388
|
+
* Pair.second(Pair.from.pair("Paris", 2_161_000)); // 2161000
|
|
1389
|
+
* ```
|
|
1390
|
+
*/
|
|
1391
|
+
const second: <A, B>(p: Pair<A, B>) => B;
|
|
1392
|
+
/**
|
|
1393
|
+
* Transforms the first value, leaving the second unchanged.
|
|
1394
|
+
*
|
|
1395
|
+
* @example
|
|
1396
|
+
* ```ts
|
|
1397
|
+
* pipe(Pair.from.pair("alice", 42), Pair.mapFirst((s) => s.toUpperCase())); // ["ALICE", 42]
|
|
1398
|
+
* ```
|
|
1399
|
+
*/
|
|
1400
|
+
const mapFirst: <A, C>(f: (a: A) => C) => <B>(p: Pair<A, B>) => Pair<C, B>;
|
|
1401
|
+
/**
|
|
1402
|
+
* Transforms the second value, leaving the first unchanged.
|
|
1403
|
+
*
|
|
1404
|
+
* @example
|
|
1405
|
+
* ```ts
|
|
1406
|
+
* pipe(Pair.from.pair("alice", 42), Pair.mapSecond((n) => n * 2)); // ["alice", 84]
|
|
1407
|
+
* ```
|
|
1408
|
+
*/
|
|
1409
|
+
const mapSecond: <B, D>(f: (b: B) => D) => <A>(p: Pair<A, B>) => Pair<A, D>;
|
|
1410
|
+
/**
|
|
1411
|
+
* Transforms both values independently in a single step.
|
|
1412
|
+
*
|
|
1413
|
+
* @example
|
|
1414
|
+
* ```ts
|
|
1415
|
+
* pipe(
|
|
1416
|
+
* Pair.from.pair("alice", 42),
|
|
1417
|
+
* Pair.mapBoth(
|
|
1418
|
+
* (name) => name.toUpperCase(),
|
|
1419
|
+
* (score) => score * 2,
|
|
1420
|
+
* ),
|
|
1421
|
+
* ); // ["ALICE", 84]
|
|
1422
|
+
* ```
|
|
1423
|
+
*/
|
|
1424
|
+
const mapBoth: <A, C, B, D>(onFirst: (a: A) => C, onSecond: (b: B) => D) => (p: Pair<A, B>) => Pair<C, D>;
|
|
1425
|
+
/**
|
|
1426
|
+
* Applies a binary function to both values, collapsing the pair into a single value.
|
|
1427
|
+
* Useful as the final step when consuming a pair in a pipeline.
|
|
1428
|
+
*
|
|
1429
|
+
* @example
|
|
1430
|
+
* ```ts
|
|
1431
|
+
* pipe(Pair.from.pair("Alice", 100), Pair.fold((name, score) => `${name}: ${score}`));
|
|
1432
|
+
* // "Alice: 100"
|
|
1433
|
+
* ```
|
|
1434
|
+
*/
|
|
1435
|
+
const fold: <A, B, C>(f: (a: A, b: B) => C) => (p: Pair<A, B>) => C;
|
|
1436
|
+
/**
|
|
1437
|
+
* Swaps the two values: `[A, B]` becomes `[B, A]`.
|
|
1438
|
+
*
|
|
1439
|
+
* @example
|
|
1440
|
+
* ```ts
|
|
1441
|
+
* Pair.swap(Pair.from.pair("key", 1)); // [1, "key"]
|
|
1442
|
+
* ```
|
|
1443
|
+
*/
|
|
1444
|
+
const swap: <A, B>(p: Pair<A, B>) => Pair<B, A>;
|
|
1445
|
+
namespace to {
|
|
1446
|
+
/**
|
|
1447
|
+
* Converts the pair to a heterogeneous readonly array `readonly (A | B)[]`.
|
|
1448
|
+
*
|
|
1449
|
+
* @example
|
|
1450
|
+
* ```ts
|
|
1451
|
+
* Pair.to.Array(Pair.from.pair("hello", 42)); // ["hello", 42]
|
|
1452
|
+
* ```
|
|
1453
|
+
*/
|
|
1454
|
+
const Array: <A, B>(p: Pair<A, B>) => readonly (A | B)[];
|
|
1455
|
+
}
|
|
1456
|
+
/**
|
|
1457
|
+
* Runs a side effect with both values without changing the pair.
|
|
1458
|
+
* Useful for logging or debugging in the middle of a pipeline.
|
|
1459
|
+
*
|
|
1460
|
+
* @example
|
|
1461
|
+
* ```ts
|
|
1462
|
+
* pipe(
|
|
1463
|
+
* Pair.from.pair("Paris", 2_161_000),
|
|
1464
|
+
* Pair.tap((city, pop) => console.log(`${city}: ${pop}`)),
|
|
1465
|
+
* Pair.mapSecond((n) => n / 1_000_000),
|
|
1466
|
+
* ); // logs "Paris: 2161000", returns ["Paris", 2.161]
|
|
1467
|
+
* ```
|
|
1468
|
+
*/
|
|
1469
|
+
const tap: <A, B>(f: (a: A, b: B) => void) => (p: Pair<A, B>) => Pair<A, B>;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1330
1472
|
/**
|
|
1331
1473
|
* A boolean-valued function over a type `A`.
|
|
1332
1474
|
*
|
|
@@ -2877,146 +3019,4 @@ declare namespace These {
|
|
|
2877
3019
|
const swap: <A, B>(data: These<A, B>) => These<B, A>;
|
|
2878
3020
|
}
|
|
2879
3021
|
|
|
2880
|
-
|
|
2881
|
-
* Tuple<A, B> represents a pair of two values that are always both present.
|
|
2882
|
-
* It is a typed alias for `readonly [A, B]`.
|
|
2883
|
-
*
|
|
2884
|
-
* Use Tuple when two values always travel together through a pipeline and you
|
|
2885
|
-
* want to transform either or both sides without destructuring.
|
|
2886
|
-
*
|
|
2887
|
-
* @example
|
|
2888
|
-
* ```ts
|
|
2889
|
-
* import { Tuple } from "@nlozgachev/pipelined/core";
|
|
2890
|
-
* import { pipe } from "@nlozgachev/pipelined/composition";
|
|
2891
|
-
*
|
|
2892
|
-
* const entry = Tuple.from.pair("alice", 42);
|
|
2893
|
-
*
|
|
2894
|
-
* pipe(
|
|
2895
|
-
* entry,
|
|
2896
|
-
* Tuple.mapFirst((name) => name.toUpperCase()),
|
|
2897
|
-
* Tuple.mapSecond((score) => score * 2),
|
|
2898
|
-
* Tuple.fold((name, score) => `${name}: ${score}`),
|
|
2899
|
-
* ); // "ALICE: 84"
|
|
2900
|
-
* ```
|
|
2901
|
-
*/
|
|
2902
|
-
type Tuple<A, B> = readonly [A, B];
|
|
2903
|
-
declare namespace Tuple {
|
|
2904
|
-
namespace from {
|
|
2905
|
-
/**
|
|
2906
|
-
* Creates a pair from two values.
|
|
2907
|
-
*
|
|
2908
|
-
* @example
|
|
2909
|
-
* ```ts
|
|
2910
|
-
* Tuple.from.pair("Paris", 2_161_000); // ["Paris", 2161000]
|
|
2911
|
-
* ```
|
|
2912
|
-
*/
|
|
2913
|
-
const pair: <A, B>(first: A, second: B) => Tuple<A, B>;
|
|
2914
|
-
/**
|
|
2915
|
-
* Creates a Tuple from a two-element array.
|
|
2916
|
-
*
|
|
2917
|
-
* @example
|
|
2918
|
-
* ```ts
|
|
2919
|
-
* Tuple.from.array(["Paris", 2_161_000] as const); // ["Paris", 2161000]
|
|
2920
|
-
* ```
|
|
2921
|
-
*/
|
|
2922
|
-
const array: <A, B>(arr: readonly [A, B]) => Tuple<A, B>;
|
|
2923
|
-
}
|
|
2924
|
-
/**
|
|
2925
|
-
* Returns the first value from the pair.
|
|
2926
|
-
*
|
|
2927
|
-
* @example
|
|
2928
|
-
* ```ts
|
|
2929
|
-
* Tuple.first(Tuple.from.pair("Paris", 2_161_000)); // "Paris"
|
|
2930
|
-
* ```
|
|
2931
|
-
*/
|
|
2932
|
-
const first: <A, B>(tuple: Tuple<A, B>) => A;
|
|
2933
|
-
/**
|
|
2934
|
-
* Returns the second value from the pair.
|
|
2935
|
-
*
|
|
2936
|
-
* @example
|
|
2937
|
-
* ```ts
|
|
2938
|
-
* Tuple.second(Tuple.from.pair("Paris", 2_161_000)); // 2161000
|
|
2939
|
-
* ```
|
|
2940
|
-
*/
|
|
2941
|
-
const second: <A, B>(tuple: Tuple<A, B>) => B;
|
|
2942
|
-
/**
|
|
2943
|
-
* Transforms the first value, leaving the second unchanged.
|
|
2944
|
-
*
|
|
2945
|
-
* @example
|
|
2946
|
-
* ```ts
|
|
2947
|
-
* pipe(Tuple.from.pair("alice", 42), Tuple.mapFirst((s) => s.toUpperCase())); // ["ALICE", 42]
|
|
2948
|
-
* ```
|
|
2949
|
-
*/
|
|
2950
|
-
const mapFirst: <A, C>(f: (a: A) => C) => <B>(tuple: Tuple<A, B>) => Tuple<C, B>;
|
|
2951
|
-
/**
|
|
2952
|
-
* Transforms the second value, leaving the first unchanged.
|
|
2953
|
-
*
|
|
2954
|
-
* @example
|
|
2955
|
-
* ```ts
|
|
2956
|
-
* pipe(Tuple.from.pair("alice", 42), Tuple.mapSecond((n) => n * 2)); // ["alice", 84]
|
|
2957
|
-
* ```
|
|
2958
|
-
*/
|
|
2959
|
-
const mapSecond: <B, D>(f: (b: B) => D) => <A>(tuple: Tuple<A, B>) => Tuple<A, D>;
|
|
2960
|
-
/**
|
|
2961
|
-
* Transforms both values independently in a single step.
|
|
2962
|
-
*
|
|
2963
|
-
* @example
|
|
2964
|
-
* ```ts
|
|
2965
|
-
* pipe(
|
|
2966
|
-
* Tuple.from.pair("alice", 42),
|
|
2967
|
-
* Tuple.mapBoth(
|
|
2968
|
-
* (name) => name.toUpperCase(),
|
|
2969
|
-
* (score) => score * 2,
|
|
2970
|
-
* ),
|
|
2971
|
-
* ); // ["ALICE", 84]
|
|
2972
|
-
* ```
|
|
2973
|
-
*/
|
|
2974
|
-
const mapBoth: <A, C, B, D>(onFirst: (a: A) => C, onSecond: (b: B) => D) => (tuple: Tuple<A, B>) => Tuple<C, D>;
|
|
2975
|
-
/**
|
|
2976
|
-
* Applies a binary function to both values, collapsing the pair into a single value.
|
|
2977
|
-
* Useful as the final step when consuming a pair in a pipeline.
|
|
2978
|
-
*
|
|
2979
|
-
* @example
|
|
2980
|
-
* ```ts
|
|
2981
|
-
* pipe(Tuple.from.pair("Alice", 100), Tuple.fold((name, score) => `${name}: ${score}`));
|
|
2982
|
-
* // "Alice: 100"
|
|
2983
|
-
* ```
|
|
2984
|
-
*/
|
|
2985
|
-
const fold: <A, B, C>(f: (a: A, b: B) => C) => (tuple: Tuple<A, B>) => C;
|
|
2986
|
-
/**
|
|
2987
|
-
* Swaps the two values: `[A, B]` becomes `[B, A]`.
|
|
2988
|
-
*
|
|
2989
|
-
* @example
|
|
2990
|
-
* ```ts
|
|
2991
|
-
* Tuple.swap(Tuple.from.pair("key", 1)); // [1, "key"]
|
|
2992
|
-
* ```
|
|
2993
|
-
*/
|
|
2994
|
-
const swap: <A, B>(tuple: Tuple<A, B>) => Tuple<B, A>;
|
|
2995
|
-
namespace to {
|
|
2996
|
-
/**
|
|
2997
|
-
* Converts the pair to a heterogeneous readonly array `readonly (A | B)[]`.
|
|
2998
|
-
*
|
|
2999
|
-
* @example
|
|
3000
|
-
* ```ts
|
|
3001
|
-
* Tuple.to.Array(Tuple.from.pair("hello", 42)); // ["hello", 42]
|
|
3002
|
-
* ```
|
|
3003
|
-
*/
|
|
3004
|
-
const Array: <A, B>(tuple: Tuple<A, B>) => readonly (A | B)[];
|
|
3005
|
-
}
|
|
3006
|
-
/**
|
|
3007
|
-
* Runs a side effect with both values without changing the pair.
|
|
3008
|
-
* Useful for logging or debugging in the middle of a pipeline.
|
|
3009
|
-
*
|
|
3010
|
-
* @example
|
|
3011
|
-
* ```ts
|
|
3012
|
-
* pipe(
|
|
3013
|
-
* Tuple.from.pair("Paris", 2_161_000),
|
|
3014
|
-
* Tuple.tap((city, pop) => console.log(`${city}: ${pop}`)),
|
|
3015
|
-
* Tuple.mapSecond((n) => n / 1_000_000),
|
|
3016
|
-
* ); // logs "Paris: 2161000", returns ["Paris", 2.161]
|
|
3017
|
-
* ```
|
|
3018
|
-
*/
|
|
3019
|
-
const tap: <A, B>(f: (a: A, b: B) => void) => (tuple: Tuple<A, B>) => Tuple<A, B>;
|
|
3020
|
-
}
|
|
3021
|
-
|
|
3022
|
-
export { Combinable, Deferred, type Failure, Lazy, Lens, type Loading, Logged, Maybe, type NotAsked, Op, Optional, Predicate, Reader, Refinement, RemoteData, Resource, Result, State, Stream, type Success, Task, These, type TheseBoth, type TheseFirst, type TheseSecond, Tuple };
|
|
3022
|
+
export { Combinable, Deferred, type Failure, Lazy, Lens, type Loading, Logged, Maybe, type NotAsked, Op, Optional, Pair, Predicate, Reader, Refinement, RemoteData, Resource, Result, State, Stream, type Success, Task, These, type TheseBoth, type TheseFirst, type TheseSecond };
|
package/dist/core.d.ts
CHANGED
|
@@ -1327,6 +1327,148 @@ declare namespace Optional {
|
|
|
1327
1327
|
const andThenLens: <A, B>(inner: Lens<A, B>) => <S>(outer: Optional<S, A>) => Optional<S, B>;
|
|
1328
1328
|
}
|
|
1329
1329
|
|
|
1330
|
+
/**
|
|
1331
|
+
* Pair<A, B> represents a pair of two values that are always both present.
|
|
1332
|
+
* It is a typed alias for `readonly [A, B]`.
|
|
1333
|
+
*
|
|
1334
|
+
* Use Pair when two values always travel together through a pipeline and you
|
|
1335
|
+
* want to transform either or both sides without destructuring.
|
|
1336
|
+
*
|
|
1337
|
+
* @example
|
|
1338
|
+
* ```ts
|
|
1339
|
+
* import { Pair } from "@nlozgachev/pipelined/core";
|
|
1340
|
+
* import { pipe } from "@nlozgachev/pipelined/composition";
|
|
1341
|
+
*
|
|
1342
|
+
* const entry = Pair.from.pair("alice", 42);
|
|
1343
|
+
*
|
|
1344
|
+
* pipe(
|
|
1345
|
+
* entry,
|
|
1346
|
+
* Pair.mapFirst((name) => name.toUpperCase()),
|
|
1347
|
+
* Pair.mapSecond((score) => score * 2),
|
|
1348
|
+
* Pair.fold((name, score) => `${name}: ${score}`),
|
|
1349
|
+
* ); // "ALICE: 84"
|
|
1350
|
+
* ```
|
|
1351
|
+
*/
|
|
1352
|
+
type Pair<A, B> = readonly [A, B];
|
|
1353
|
+
declare namespace Pair {
|
|
1354
|
+
namespace from {
|
|
1355
|
+
/**
|
|
1356
|
+
* Creates a Pair from two values.
|
|
1357
|
+
*
|
|
1358
|
+
* @example
|
|
1359
|
+
* ```ts
|
|
1360
|
+
* Pair.from.pair("Paris", 2_161_000); // ["Paris", 2161000]
|
|
1361
|
+
* ```
|
|
1362
|
+
*/
|
|
1363
|
+
const pair: <A, B>(first: A, second: B) => Pair<A, B>;
|
|
1364
|
+
/**
|
|
1365
|
+
* Creates a Pair from a two-element array.
|
|
1366
|
+
*
|
|
1367
|
+
* @example
|
|
1368
|
+
* ```ts
|
|
1369
|
+
* Pair.from.array(["Paris", 2_161_000] as const); // ["Paris", 2161000]
|
|
1370
|
+
* ```
|
|
1371
|
+
*/
|
|
1372
|
+
const array: <A, B>(arr: readonly [A, B]) => Pair<A, B>;
|
|
1373
|
+
}
|
|
1374
|
+
/**
|
|
1375
|
+
* Returns the first value from the pair.
|
|
1376
|
+
*
|
|
1377
|
+
* @example
|
|
1378
|
+
* ```ts
|
|
1379
|
+
* Pair.first(Pair.from.pair("Paris", 2_161_000)); // "Paris"
|
|
1380
|
+
* ```
|
|
1381
|
+
*/
|
|
1382
|
+
const first: <A, B>(p: Pair<A, B>) => A;
|
|
1383
|
+
/**
|
|
1384
|
+
* Returns the second value from the pair.
|
|
1385
|
+
*
|
|
1386
|
+
* @example
|
|
1387
|
+
* ```ts
|
|
1388
|
+
* Pair.second(Pair.from.pair("Paris", 2_161_000)); // 2161000
|
|
1389
|
+
* ```
|
|
1390
|
+
*/
|
|
1391
|
+
const second: <A, B>(p: Pair<A, B>) => B;
|
|
1392
|
+
/**
|
|
1393
|
+
* Transforms the first value, leaving the second unchanged.
|
|
1394
|
+
*
|
|
1395
|
+
* @example
|
|
1396
|
+
* ```ts
|
|
1397
|
+
* pipe(Pair.from.pair("alice", 42), Pair.mapFirst((s) => s.toUpperCase())); // ["ALICE", 42]
|
|
1398
|
+
* ```
|
|
1399
|
+
*/
|
|
1400
|
+
const mapFirst: <A, C>(f: (a: A) => C) => <B>(p: Pair<A, B>) => Pair<C, B>;
|
|
1401
|
+
/**
|
|
1402
|
+
* Transforms the second value, leaving the first unchanged.
|
|
1403
|
+
*
|
|
1404
|
+
* @example
|
|
1405
|
+
* ```ts
|
|
1406
|
+
* pipe(Pair.from.pair("alice", 42), Pair.mapSecond((n) => n * 2)); // ["alice", 84]
|
|
1407
|
+
* ```
|
|
1408
|
+
*/
|
|
1409
|
+
const mapSecond: <B, D>(f: (b: B) => D) => <A>(p: Pair<A, B>) => Pair<A, D>;
|
|
1410
|
+
/**
|
|
1411
|
+
* Transforms both values independently in a single step.
|
|
1412
|
+
*
|
|
1413
|
+
* @example
|
|
1414
|
+
* ```ts
|
|
1415
|
+
* pipe(
|
|
1416
|
+
* Pair.from.pair("alice", 42),
|
|
1417
|
+
* Pair.mapBoth(
|
|
1418
|
+
* (name) => name.toUpperCase(),
|
|
1419
|
+
* (score) => score * 2,
|
|
1420
|
+
* ),
|
|
1421
|
+
* ); // ["ALICE", 84]
|
|
1422
|
+
* ```
|
|
1423
|
+
*/
|
|
1424
|
+
const mapBoth: <A, C, B, D>(onFirst: (a: A) => C, onSecond: (b: B) => D) => (p: Pair<A, B>) => Pair<C, D>;
|
|
1425
|
+
/**
|
|
1426
|
+
* Applies a binary function to both values, collapsing the pair into a single value.
|
|
1427
|
+
* Useful as the final step when consuming a pair in a pipeline.
|
|
1428
|
+
*
|
|
1429
|
+
* @example
|
|
1430
|
+
* ```ts
|
|
1431
|
+
* pipe(Pair.from.pair("Alice", 100), Pair.fold((name, score) => `${name}: ${score}`));
|
|
1432
|
+
* // "Alice: 100"
|
|
1433
|
+
* ```
|
|
1434
|
+
*/
|
|
1435
|
+
const fold: <A, B, C>(f: (a: A, b: B) => C) => (p: Pair<A, B>) => C;
|
|
1436
|
+
/**
|
|
1437
|
+
* Swaps the two values: `[A, B]` becomes `[B, A]`.
|
|
1438
|
+
*
|
|
1439
|
+
* @example
|
|
1440
|
+
* ```ts
|
|
1441
|
+
* Pair.swap(Pair.from.pair("key", 1)); // [1, "key"]
|
|
1442
|
+
* ```
|
|
1443
|
+
*/
|
|
1444
|
+
const swap: <A, B>(p: Pair<A, B>) => Pair<B, A>;
|
|
1445
|
+
namespace to {
|
|
1446
|
+
/**
|
|
1447
|
+
* Converts the pair to a heterogeneous readonly array `readonly (A | B)[]`.
|
|
1448
|
+
*
|
|
1449
|
+
* @example
|
|
1450
|
+
* ```ts
|
|
1451
|
+
* Pair.to.Array(Pair.from.pair("hello", 42)); // ["hello", 42]
|
|
1452
|
+
* ```
|
|
1453
|
+
*/
|
|
1454
|
+
const Array: <A, B>(p: Pair<A, B>) => readonly (A | B)[];
|
|
1455
|
+
}
|
|
1456
|
+
/**
|
|
1457
|
+
* Runs a side effect with both values without changing the pair.
|
|
1458
|
+
* Useful for logging or debugging in the middle of a pipeline.
|
|
1459
|
+
*
|
|
1460
|
+
* @example
|
|
1461
|
+
* ```ts
|
|
1462
|
+
* pipe(
|
|
1463
|
+
* Pair.from.pair("Paris", 2_161_000),
|
|
1464
|
+
* Pair.tap((city, pop) => console.log(`${city}: ${pop}`)),
|
|
1465
|
+
* Pair.mapSecond((n) => n / 1_000_000),
|
|
1466
|
+
* ); // logs "Paris: 2161000", returns ["Paris", 2.161]
|
|
1467
|
+
* ```
|
|
1468
|
+
*/
|
|
1469
|
+
const tap: <A, B>(f: (a: A, b: B) => void) => (p: Pair<A, B>) => Pair<A, B>;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1330
1472
|
/**
|
|
1331
1473
|
* A boolean-valued function over a type `A`.
|
|
1332
1474
|
*
|
|
@@ -2877,146 +3019,4 @@ declare namespace These {
|
|
|
2877
3019
|
const swap: <A, B>(data: These<A, B>) => These<B, A>;
|
|
2878
3020
|
}
|
|
2879
3021
|
|
|
2880
|
-
|
|
2881
|
-
* Tuple<A, B> represents a pair of two values that are always both present.
|
|
2882
|
-
* It is a typed alias for `readonly [A, B]`.
|
|
2883
|
-
*
|
|
2884
|
-
* Use Tuple when two values always travel together through a pipeline and you
|
|
2885
|
-
* want to transform either or both sides without destructuring.
|
|
2886
|
-
*
|
|
2887
|
-
* @example
|
|
2888
|
-
* ```ts
|
|
2889
|
-
* import { Tuple } from "@nlozgachev/pipelined/core";
|
|
2890
|
-
* import { pipe } from "@nlozgachev/pipelined/composition";
|
|
2891
|
-
*
|
|
2892
|
-
* const entry = Tuple.from.pair("alice", 42);
|
|
2893
|
-
*
|
|
2894
|
-
* pipe(
|
|
2895
|
-
* entry,
|
|
2896
|
-
* Tuple.mapFirst((name) => name.toUpperCase()),
|
|
2897
|
-
* Tuple.mapSecond((score) => score * 2),
|
|
2898
|
-
* Tuple.fold((name, score) => `${name}: ${score}`),
|
|
2899
|
-
* ); // "ALICE: 84"
|
|
2900
|
-
* ```
|
|
2901
|
-
*/
|
|
2902
|
-
type Tuple<A, B> = readonly [A, B];
|
|
2903
|
-
declare namespace Tuple {
|
|
2904
|
-
namespace from {
|
|
2905
|
-
/**
|
|
2906
|
-
* Creates a pair from two values.
|
|
2907
|
-
*
|
|
2908
|
-
* @example
|
|
2909
|
-
* ```ts
|
|
2910
|
-
* Tuple.from.pair("Paris", 2_161_000); // ["Paris", 2161000]
|
|
2911
|
-
* ```
|
|
2912
|
-
*/
|
|
2913
|
-
const pair: <A, B>(first: A, second: B) => Tuple<A, B>;
|
|
2914
|
-
/**
|
|
2915
|
-
* Creates a Tuple from a two-element array.
|
|
2916
|
-
*
|
|
2917
|
-
* @example
|
|
2918
|
-
* ```ts
|
|
2919
|
-
* Tuple.from.array(["Paris", 2_161_000] as const); // ["Paris", 2161000]
|
|
2920
|
-
* ```
|
|
2921
|
-
*/
|
|
2922
|
-
const array: <A, B>(arr: readonly [A, B]) => Tuple<A, B>;
|
|
2923
|
-
}
|
|
2924
|
-
/**
|
|
2925
|
-
* Returns the first value from the pair.
|
|
2926
|
-
*
|
|
2927
|
-
* @example
|
|
2928
|
-
* ```ts
|
|
2929
|
-
* Tuple.first(Tuple.from.pair("Paris", 2_161_000)); // "Paris"
|
|
2930
|
-
* ```
|
|
2931
|
-
*/
|
|
2932
|
-
const first: <A, B>(tuple: Tuple<A, B>) => A;
|
|
2933
|
-
/**
|
|
2934
|
-
* Returns the second value from the pair.
|
|
2935
|
-
*
|
|
2936
|
-
* @example
|
|
2937
|
-
* ```ts
|
|
2938
|
-
* Tuple.second(Tuple.from.pair("Paris", 2_161_000)); // 2161000
|
|
2939
|
-
* ```
|
|
2940
|
-
*/
|
|
2941
|
-
const second: <A, B>(tuple: Tuple<A, B>) => B;
|
|
2942
|
-
/**
|
|
2943
|
-
* Transforms the first value, leaving the second unchanged.
|
|
2944
|
-
*
|
|
2945
|
-
* @example
|
|
2946
|
-
* ```ts
|
|
2947
|
-
* pipe(Tuple.from.pair("alice", 42), Tuple.mapFirst((s) => s.toUpperCase())); // ["ALICE", 42]
|
|
2948
|
-
* ```
|
|
2949
|
-
*/
|
|
2950
|
-
const mapFirst: <A, C>(f: (a: A) => C) => <B>(tuple: Tuple<A, B>) => Tuple<C, B>;
|
|
2951
|
-
/**
|
|
2952
|
-
* Transforms the second value, leaving the first unchanged.
|
|
2953
|
-
*
|
|
2954
|
-
* @example
|
|
2955
|
-
* ```ts
|
|
2956
|
-
* pipe(Tuple.from.pair("alice", 42), Tuple.mapSecond((n) => n * 2)); // ["alice", 84]
|
|
2957
|
-
* ```
|
|
2958
|
-
*/
|
|
2959
|
-
const mapSecond: <B, D>(f: (b: B) => D) => <A>(tuple: Tuple<A, B>) => Tuple<A, D>;
|
|
2960
|
-
/**
|
|
2961
|
-
* Transforms both values independently in a single step.
|
|
2962
|
-
*
|
|
2963
|
-
* @example
|
|
2964
|
-
* ```ts
|
|
2965
|
-
* pipe(
|
|
2966
|
-
* Tuple.from.pair("alice", 42),
|
|
2967
|
-
* Tuple.mapBoth(
|
|
2968
|
-
* (name) => name.toUpperCase(),
|
|
2969
|
-
* (score) => score * 2,
|
|
2970
|
-
* ),
|
|
2971
|
-
* ); // ["ALICE", 84]
|
|
2972
|
-
* ```
|
|
2973
|
-
*/
|
|
2974
|
-
const mapBoth: <A, C, B, D>(onFirst: (a: A) => C, onSecond: (b: B) => D) => (tuple: Tuple<A, B>) => Tuple<C, D>;
|
|
2975
|
-
/**
|
|
2976
|
-
* Applies a binary function to both values, collapsing the pair into a single value.
|
|
2977
|
-
* Useful as the final step when consuming a pair in a pipeline.
|
|
2978
|
-
*
|
|
2979
|
-
* @example
|
|
2980
|
-
* ```ts
|
|
2981
|
-
* pipe(Tuple.from.pair("Alice", 100), Tuple.fold((name, score) => `${name}: ${score}`));
|
|
2982
|
-
* // "Alice: 100"
|
|
2983
|
-
* ```
|
|
2984
|
-
*/
|
|
2985
|
-
const fold: <A, B, C>(f: (a: A, b: B) => C) => (tuple: Tuple<A, B>) => C;
|
|
2986
|
-
/**
|
|
2987
|
-
* Swaps the two values: `[A, B]` becomes `[B, A]`.
|
|
2988
|
-
*
|
|
2989
|
-
* @example
|
|
2990
|
-
* ```ts
|
|
2991
|
-
* Tuple.swap(Tuple.from.pair("key", 1)); // [1, "key"]
|
|
2992
|
-
* ```
|
|
2993
|
-
*/
|
|
2994
|
-
const swap: <A, B>(tuple: Tuple<A, B>) => Tuple<B, A>;
|
|
2995
|
-
namespace to {
|
|
2996
|
-
/**
|
|
2997
|
-
* Converts the pair to a heterogeneous readonly array `readonly (A | B)[]`.
|
|
2998
|
-
*
|
|
2999
|
-
* @example
|
|
3000
|
-
* ```ts
|
|
3001
|
-
* Tuple.to.Array(Tuple.from.pair("hello", 42)); // ["hello", 42]
|
|
3002
|
-
* ```
|
|
3003
|
-
*/
|
|
3004
|
-
const Array: <A, B>(tuple: Tuple<A, B>) => readonly (A | B)[];
|
|
3005
|
-
}
|
|
3006
|
-
/**
|
|
3007
|
-
* Runs a side effect with both values without changing the pair.
|
|
3008
|
-
* Useful for logging or debugging in the middle of a pipeline.
|
|
3009
|
-
*
|
|
3010
|
-
* @example
|
|
3011
|
-
* ```ts
|
|
3012
|
-
* pipe(
|
|
3013
|
-
* Tuple.from.pair("Paris", 2_161_000),
|
|
3014
|
-
* Tuple.tap((city, pop) => console.log(`${city}: ${pop}`)),
|
|
3015
|
-
* Tuple.mapSecond((n) => n / 1_000_000),
|
|
3016
|
-
* ); // logs "Paris: 2161000", returns ["Paris", 2.161]
|
|
3017
|
-
* ```
|
|
3018
|
-
*/
|
|
3019
|
-
const tap: <A, B>(f: (a: A, b: B) => void) => (tuple: Tuple<A, B>) => Tuple<A, B>;
|
|
3020
|
-
}
|
|
3021
|
-
|
|
3022
|
-
export { Combinable, Deferred, type Failure, Lazy, Lens, type Loading, Logged, Maybe, type NotAsked, Op, Optional, Predicate, Reader, Refinement, RemoteData, Resource, Result, State, Stream, type Success, Task, These, type TheseBoth, type TheseFirst, type TheseSecond, Tuple };
|
|
3022
|
+
export { Combinable, Deferred, type Failure, Lazy, Lens, type Loading, Logged, Maybe, type NotAsked, Op, Optional, Pair, Predicate, Reader, Refinement, RemoteData, Resource, Result, State, Stream, type Success, Task, These, type TheseBoth, type TheseFirst, type TheseSecond };
|
package/dist/core.js
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
Op,
|
|
10
10
|
Optional,
|
|
11
11
|
Ordering,
|
|
12
|
+
Pair,
|
|
12
13
|
Predicate,
|
|
13
14
|
Reader,
|
|
14
15
|
Refinement,
|
|
@@ -19,9 +20,8 @@ import {
|
|
|
19
20
|
Stream,
|
|
20
21
|
Task,
|
|
21
22
|
These,
|
|
22
|
-
Tuple,
|
|
23
23
|
Validation
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-VYHAA4KO.js";
|
|
25
25
|
import "./chunk-OIIOGDHK.js";
|
|
26
26
|
export {
|
|
27
27
|
Combinable,
|
|
@@ -34,6 +34,7 @@ export {
|
|
|
34
34
|
Op,
|
|
35
35
|
Optional,
|
|
36
36
|
Ordering,
|
|
37
|
+
Pair,
|
|
37
38
|
Predicate,
|
|
38
39
|
Reader,
|
|
39
40
|
Refinement,
|
|
@@ -44,6 +45,5 @@ export {
|
|
|
44
45
|
Stream,
|
|
45
46
|
Task,
|
|
46
47
|
These,
|
|
47
|
-
Tuple,
|
|
48
48
|
Validation
|
|
49
49
|
};
|
package/dist/data.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -37,6 +37,7 @@ __export(src_exports, {
|
|
|
37
37
|
Op: () => Op,
|
|
38
38
|
Optional: () => Optional,
|
|
39
39
|
Ordering: () => Ordering,
|
|
40
|
+
Pair: () => Pair,
|
|
40
41
|
Predicate: () => Predicate,
|
|
41
42
|
Reader: () => Reader,
|
|
42
43
|
Rec: () => Rec,
|
|
@@ -50,7 +51,6 @@ __export(src_exports, {
|
|
|
50
51
|
Stream: () => Stream,
|
|
51
52
|
Task: () => Task,
|
|
52
53
|
These: () => These,
|
|
53
|
-
Tuple: () => Tuple,
|
|
54
54
|
Uniq: () => Uniq,
|
|
55
55
|
Validation: () => Validation,
|
|
56
56
|
and: () => and,
|
|
@@ -1955,6 +1955,34 @@ var Ordering;
|
|
|
1955
1955
|
};
|
|
1956
1956
|
})(Ordering || (Ordering = {}));
|
|
1957
1957
|
|
|
1958
|
+
// src/Core/Pair.ts
|
|
1959
|
+
var Pair;
|
|
1960
|
+
((Pair2) => {
|
|
1961
|
+
let from;
|
|
1962
|
+
((from2) => {
|
|
1963
|
+
from2.pair = (first2, second2) => [first2, second2];
|
|
1964
|
+
from2.array = (arr) => arr;
|
|
1965
|
+
})(from = Pair2.from || (Pair2.from = {}));
|
|
1966
|
+
Pair2.first = (p) => p[0];
|
|
1967
|
+
Pair2.second = (p) => p[1];
|
|
1968
|
+
Pair2.mapFirst = (f) => (p) => [f(p[0]), p[1]];
|
|
1969
|
+
Pair2.mapSecond = (f) => (p) => [p[0], f(p[1])];
|
|
1970
|
+
Pair2.mapBoth = (onFirst, onSecond) => (p) => [
|
|
1971
|
+
onFirst(p[0]),
|
|
1972
|
+
onSecond(p[1])
|
|
1973
|
+
];
|
|
1974
|
+
Pair2.fold = (f) => (p) => f(p[0], p[1]);
|
|
1975
|
+
Pair2.swap = (p) => [p[1], p[0]];
|
|
1976
|
+
let to;
|
|
1977
|
+
((to2) => {
|
|
1978
|
+
to2.Array = (p) => [...p];
|
|
1979
|
+
})(to = Pair2.to || (Pair2.to = {}));
|
|
1980
|
+
Pair2.tap = (f) => (p) => {
|
|
1981
|
+
f(p[0], p[1]);
|
|
1982
|
+
return p;
|
|
1983
|
+
};
|
|
1984
|
+
})(Pair || (Pair = {}));
|
|
1985
|
+
|
|
1958
1986
|
// src/Core/Predicate.ts
|
|
1959
1987
|
var Predicate;
|
|
1960
1988
|
((Predicate2) => {
|
|
@@ -3013,34 +3041,6 @@ var These;
|
|
|
3013
3041
|
};
|
|
3014
3042
|
})(These || (These = {}));
|
|
3015
3043
|
|
|
3016
|
-
// src/Core/Tuple.ts
|
|
3017
|
-
var Tuple;
|
|
3018
|
-
((Tuple2) => {
|
|
3019
|
-
let from;
|
|
3020
|
-
((from2) => {
|
|
3021
|
-
from2.pair = (first2, second2) => [first2, second2];
|
|
3022
|
-
from2.array = (arr) => arr;
|
|
3023
|
-
})(from = Tuple2.from || (Tuple2.from = {}));
|
|
3024
|
-
Tuple2.first = (tuple2) => tuple2[0];
|
|
3025
|
-
Tuple2.second = (tuple2) => tuple2[1];
|
|
3026
|
-
Tuple2.mapFirst = (f) => (tuple2) => [f(tuple2[0]), tuple2[1]];
|
|
3027
|
-
Tuple2.mapSecond = (f) => (tuple2) => [tuple2[0], f(tuple2[1])];
|
|
3028
|
-
Tuple2.mapBoth = (onFirst, onSecond) => (tuple2) => [
|
|
3029
|
-
onFirst(tuple2[0]),
|
|
3030
|
-
onSecond(tuple2[1])
|
|
3031
|
-
];
|
|
3032
|
-
Tuple2.fold = (f) => (tuple2) => f(tuple2[0], tuple2[1]);
|
|
3033
|
-
Tuple2.swap = (tuple2) => [tuple2[1], tuple2[0]];
|
|
3034
|
-
let to;
|
|
3035
|
-
((to2) => {
|
|
3036
|
-
to2.Array = (tuple2) => [...tuple2];
|
|
3037
|
-
})(to = Tuple2.to || (Tuple2.to = {}));
|
|
3038
|
-
Tuple2.tap = (f) => (tuple2) => {
|
|
3039
|
-
f(tuple2[0], tuple2[1]);
|
|
3040
|
-
return tuple2;
|
|
3041
|
-
};
|
|
3042
|
-
})(Tuple || (Tuple = {}));
|
|
3043
|
-
|
|
3044
3044
|
// src/Core/Validation.ts
|
|
3045
3045
|
var Validation;
|
|
3046
3046
|
((Validation2) => {
|
|
@@ -4472,6 +4472,7 @@ var Uniq;
|
|
|
4472
4472
|
Op,
|
|
4473
4473
|
Optional,
|
|
4474
4474
|
Ordering,
|
|
4475
|
+
Pair,
|
|
4475
4476
|
Predicate,
|
|
4476
4477
|
Reader,
|
|
4477
4478
|
Rec,
|
|
@@ -4485,7 +4486,6 @@ var Uniq;
|
|
|
4485
4486
|
Stream,
|
|
4486
4487
|
Task,
|
|
4487
4488
|
These,
|
|
4488
|
-
Tuple,
|
|
4489
4489
|
Uniq,
|
|
4490
4490
|
Validation,
|
|
4491
4491
|
and,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { and, compose, constFalse, constNull, constTrue, constUndefined, constVoid, constant, converge, curry, curry3, curry4, defaultTo, flip, flow, identity, juxt, memoize, memoizeWeak, not, on, once, or, pipe, tap, tuple, uncurry, uncurry3, uncurry4, untuple } from './composition.cjs';
|
|
2
|
-
export { Combinable, Failure, Lazy, Lens, Loading, Logged, NotAsked, Op, Optional, Predicate, Reader, Refinement, RemoteData, Resource, State, Stream, Success, These, TheseBoth, TheseFirst, TheseSecond
|
|
2
|
+
export { Combinable, Failure, Lazy, Lens, Loading, Logged, NotAsked, Op, Optional, Pair, Predicate, Reader, Refinement, RemoteData, Resource, State, Stream, Success, These, TheseBoth, TheseFirst, TheseSecond } from './core.cjs';
|
|
3
3
|
export { D as Deferred } from './InternalTypes-DuK_XpTi.cjs';
|
|
4
4
|
export { E as Equality, a as Err, F as Failed, M as Maybe, N as None, O as Ok, b as Ordering, P as Passed, R as Result, S as Some, T as Task, V as Validation } from './Validation-DC3uUizM.cjs';
|
|
5
5
|
export { Arr, BigNum, Dict, Json, NonEmptyMap, NonEmptyRecord, NonEmptySet, NonEmptyString, Num, Rec, Str, Uniq } from './data.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { and, compose, constFalse, constNull, constTrue, constUndefined, constVoid, constant, converge, curry, curry3, curry4, defaultTo, flip, flow, identity, juxt, memoize, memoizeWeak, not, on, once, or, pipe, tap, tuple, uncurry, uncurry3, uncurry4, untuple } from './composition.js';
|
|
2
|
-
export { Combinable, Failure, Lazy, Lens, Loading, Logged, NotAsked, Op, Optional, Predicate, Reader, Refinement, RemoteData, Resource, State, Stream, Success, These, TheseBoth, TheseFirst, TheseSecond
|
|
2
|
+
export { Combinable, Failure, Lazy, Lens, Loading, Logged, NotAsked, Op, Optional, Pair, Predicate, Reader, Refinement, RemoteData, Resource, State, Stream, Success, These, TheseBoth, TheseFirst, TheseSecond } from './core.js';
|
|
3
3
|
export { D as Deferred } from './InternalTypes-LdhLQx3N.js';
|
|
4
4
|
export { E as Equality, a as Err, F as Failed, M as Maybe, N as None, O as Ok, b as Ordering, P as Passed, R as Result, S as Some, T as Task, V as Validation } from './Validation-DZLizBZ0.js';
|
|
5
5
|
export { Arr, BigNum, Dict, Json, NonEmptyMap, NonEmptyRecord, NonEmptySet, NonEmptyString, Num, Rec, Str, Uniq } from './data.js';
|
package/dist/index.js
CHANGED
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
Rec,
|
|
40
40
|
Str,
|
|
41
41
|
Uniq
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-FVWJMPQI.js";
|
|
43
43
|
import {
|
|
44
44
|
Combinable,
|
|
45
45
|
Deferred,
|
|
@@ -51,6 +51,7 @@ import {
|
|
|
51
51
|
Op,
|
|
52
52
|
Optional,
|
|
53
53
|
Ordering,
|
|
54
|
+
Pair,
|
|
54
55
|
Predicate,
|
|
55
56
|
Reader,
|
|
56
57
|
Refinement,
|
|
@@ -61,9 +62,8 @@ import {
|
|
|
61
62
|
Stream,
|
|
62
63
|
Task,
|
|
63
64
|
These,
|
|
64
|
-
Tuple,
|
|
65
65
|
Validation
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-VYHAA4KO.js";
|
|
67
67
|
import {
|
|
68
68
|
Brand,
|
|
69
69
|
Duration,
|
|
@@ -87,6 +87,7 @@ export {
|
|
|
87
87
|
Op,
|
|
88
88
|
Optional,
|
|
89
89
|
Ordering,
|
|
90
|
+
Pair,
|
|
90
91
|
Predicate,
|
|
91
92
|
Reader,
|
|
92
93
|
Rec,
|
|
@@ -100,7 +101,6 @@ export {
|
|
|
100
101
|
Stream,
|
|
101
102
|
Task,
|
|
102
103
|
These,
|
|
103
|
-
Tuple,
|
|
104
104
|
Uniq,
|
|
105
105
|
Validation,
|
|
106
106
|
and,
|