@nlozgachev/pipelined 0.38.0 → 0.40.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 CHANGED
@@ -33,7 +33,7 @@ not anything is there:
33
33
  ```ts
34
34
  import { pipe } from "@nlozgachev/pipelined/composition";
35
35
  import { Maybe } from "@nlozgachev/pipelined/core";
36
- import { Num, Str } from "@nlozgachev/pipelined/utils";
36
+ import { Num, Str } from "@nlozgachev/pipelined/data";
37
37
 
38
38
  const parseDiscount = (raw: string): string =>
39
39
  pipe(
@@ -120,7 +120,7 @@ steps to compose naturally with the core types:
120
120
  ```ts
121
121
  import { pipe } from "@nlozgachev/pipelined/composition";
122
122
  import { Maybe } from "@nlozgachev/pipelined/core";
123
- import { Arr, Num, Rec, Str } from "@nlozgachev/pipelined/utils";
123
+ import { Arr, Num, Rec, Str } from "@nlozgachev/pipelined/data";
124
124
 
125
125
  type RawItem = { name: string; price: string; category: string };
126
126
  type Item = { name: string; price: number; category: string };
@@ -1871,17 +1871,15 @@ var TaskResult3;
1871
1871
  )(data);
1872
1872
  TaskResult4.struct = (fields) => Task.from((signal) => {
1873
1873
  const keys = Object.keys(fields);
1874
- const promises = keys.map((key) => Deferred.toPromise(fields[key](signal)).then((res) => ({ key, res })));
1874
+ const promises = keys.map((key) => Deferred.toPromise(fields[key](signal)));
1875
1875
  return Promise.all(promises).then((results) => {
1876
1876
  const record = {};
1877
- for (const key of keys) {
1878
- const found = results.find((r) => r.key === key);
1879
- if (found) {
1880
- if (Result.isErr(found.res)) {
1881
- return found.res;
1882
- }
1883
- record[key] = found.res.value;
1877
+ for (let i = 0; i < keys.length; i++) {
1878
+ const res = results[i];
1879
+ if (Result.isErr(res)) {
1880
+ return res;
1884
1881
  }
1882
+ record[keys[i]] = res.value;
1885
1883
  }
1886
1884
  return Result.ok(record);
1887
1885
  });
@@ -3,12 +3,12 @@ import {
3
3
  Maybe,
4
4
  Result,
5
5
  Task
6
- } from "./chunk-M2X7TFKN.mjs";
6
+ } from "./chunk-4R4XUP4M.mjs";
7
7
  import {
8
8
  isNonEmptyList
9
9
  } from "./chunk-5AFEEFE4.mjs";
10
10
 
11
- // src/Utils/Arr.ts
11
+ // src/Data/Arr.ts
12
12
  var Arr;
13
13
  ((Arr2) => {
14
14
  Arr2.head = (data) => data.length > 0 ? Maybe.some(data[0]) : Maybe.none();
@@ -340,7 +340,7 @@ var Arr;
340
340
  };
341
341
  })(Arr || (Arr = {}));
342
342
 
343
- // src/Utils/Dict.ts
343
+ // src/Data/Dict.ts
344
344
  var Dict;
345
345
  ((Dict2) => {
346
346
  Dict2.empty = () => new globalThis.Map();
@@ -478,7 +478,7 @@ var Dict;
478
478
  Dict2.toRecord = (m) => Object.fromEntries(m);
479
479
  })(Dict || (Dict = {}));
480
480
 
481
- // src/Utils/Num.ts
481
+ // src/Data/Num.ts
482
482
  var Num;
483
483
  ((Num2) => {
484
484
  Num2.range = (from, to, step = 1) => {
@@ -545,7 +545,7 @@ var Num;
545
545
  };
546
546
  })(Num || (Num = {}));
547
547
 
548
- // src/Utils/Rec.ts
548
+ // src/Data/Rec.ts
549
549
  var Rec;
550
550
  ((Rec2) => {
551
551
  Rec2.map = (f) => (data) => {
@@ -673,7 +673,7 @@ var Rec;
673
673
  };
674
674
  })(Rec || (Rec = {}));
675
675
 
676
- // src/Utils/Str.ts
676
+ // src/Data/Str.ts
677
677
  var Str;
678
678
  ((Str2) => {
679
679
  Str2.split = (separator) => (s) => s.split(separator);
@@ -733,7 +733,7 @@ var Str;
733
733
  };
734
734
  })(Str || (Str = {}));
735
735
 
736
- // src/Utils/Uniq.ts
736
+ // src/Data/Uniq.ts
737
737
  var Uniq;
738
738
  ((Uniq2) => {
739
739
  Uniq2.empty = () => new globalThis.Set();
package/dist/core.js CHANGED
@@ -1941,17 +1941,15 @@ var TaskResult3;
1941
1941
  )(data);
1942
1942
  TaskResult4.struct = (fields) => Task.from((signal) => {
1943
1943
  const keys = Object.keys(fields);
1944
- const promises = keys.map((key) => Deferred.toPromise(fields[key](signal)).then((res) => ({ key, res })));
1944
+ const promises = keys.map((key) => Deferred.toPromise(fields[key](signal)));
1945
1945
  return Promise.all(promises).then((results) => {
1946
1946
  const record = {};
1947
- for (const key of keys) {
1948
- const found = results.find((r) => r.key === key);
1949
- if (found) {
1950
- if (Result.isErr(found.res)) {
1951
- return found.res;
1952
- }
1953
- record[key] = found.res.value;
1947
+ for (let i = 0; i < keys.length; i++) {
1948
+ const res = results[i];
1949
+ if (Result.isErr(res)) {
1950
+ return res;
1954
1951
  }
1952
+ record[keys[i]] = res.value;
1955
1953
  }
1956
1954
  return Result.ok(record);
1957
1955
  });
package/dist/core.mjs CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  These,
24
24
  Tuple,
25
25
  Validation
26
- } from "./chunk-M2X7TFKN.mjs";
26
+ } from "./chunk-4R4XUP4M.mjs";
27
27
  import "./chunk-5AFEEFE4.mjs";
28
28
  export {
29
29
  Combinable,
package/dist/index.d.mts 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, uncurry, uncurry3, uncurry4 } from './composition.mjs';
2
2
  export { Combinable, Failed, Failure, Lazy, Lens, Loading, Logged, NotAsked, Op, Optional, Passed, Predicate, Reader, Refinement, RemoteData, Resource, State, Success, TaskMaybe, TaskResult, TaskValidation, These, TheseBoth, TheseFirst, TheseSecond, Tuple, Validation } from './core.mjs';
3
3
  export { D as Deferred, E as Equality, a as Err, M as Maybe, N as None, O as Ok, b as Ordering, R as Result, S as Some, T as Task } from './Task-DcXhCZYg.mjs';
4
- export { Brand, Duration, NonEmptyList, isNonEmptyList } from './types.mjs';
5
4
  export { Arr, Dict, Num, Rec, Str, Uniq } from './utils.mjs';
5
+ export { Brand, Duration, NonEmptyList, isNonEmptyList } from './types.mjs';
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, uncurry, uncurry3, uncurry4 } from './composition.js';
2
2
  export { Combinable, Failed, Failure, Lazy, Lens, Loading, Logged, NotAsked, Op, Optional, Passed, Predicate, Reader, Refinement, RemoteData, Resource, State, Success, TaskMaybe, TaskResult, TaskValidation, These, TheseBoth, TheseFirst, TheseSecond, Tuple, Validation } from './core.js';
3
3
  export { D as Deferred, E as Equality, a as Err, M as Maybe, N as None, O as Ok, b as Ordering, R as Result, S as Some, T as Task } from './Task-uupX7xd9.js';
4
- export { Brand, Duration, NonEmptyList, isNonEmptyList } from './types.js';
5
4
  export { Arr, Dict, Num, Rec, Str, Uniq } from './utils.js';
5
+ export { Brand, Duration, NonEmptyList, isNonEmptyList } from './types.js';
package/dist/index.js CHANGED
@@ -2314,17 +2314,15 @@ var TaskResult3;
2314
2314
  )(data);
2315
2315
  TaskResult4.struct = (fields) => Task.from((signal) => {
2316
2316
  const keys = Object.keys(fields);
2317
- const promises = keys.map((key) => Deferred.toPromise(fields[key](signal)).then((res) => ({ key, res })));
2317
+ const promises = keys.map((key) => Deferred.toPromise(fields[key](signal)));
2318
2318
  return Promise.all(promises).then((results) => {
2319
2319
  const record = {};
2320
- for (const key of keys) {
2321
- const found = results.find((r) => r.key === key);
2322
- if (found) {
2323
- if (Result.isErr(found.res)) {
2324
- return found.res;
2325
- }
2326
- record[key] = found.res.value;
2320
+ for (let i = 0; i < keys.length; i++) {
2321
+ const res = results[i];
2322
+ if (Result.isErr(res)) {
2323
+ return res;
2327
2324
  }
2325
+ record[keys[i]] = res.value;
2328
2326
  }
2329
2327
  return Result.ok(record);
2330
2328
  });
@@ -2551,7 +2549,7 @@ var Validation;
2551
2549
  };
2552
2550
  })(Validation || (Validation = {}));
2553
2551
 
2554
- // src/Utils/Arr.ts
2552
+ // src/Data/Arr.ts
2555
2553
  var Arr;
2556
2554
  ((Arr2) => {
2557
2555
  Arr2.head = (data) => data.length > 0 ? Maybe.some(data[0]) : Maybe.none();
@@ -2883,7 +2881,7 @@ var Arr;
2883
2881
  };
2884
2882
  })(Arr || (Arr = {}));
2885
2883
 
2886
- // src/Utils/Dict.ts
2884
+ // src/Data/Dict.ts
2887
2885
  var Dict;
2888
2886
  ((Dict2) => {
2889
2887
  Dict2.empty = () => new globalThis.Map();
@@ -3021,7 +3019,7 @@ var Dict;
3021
3019
  Dict2.toRecord = (m) => Object.fromEntries(m);
3022
3020
  })(Dict || (Dict = {}));
3023
3021
 
3024
- // src/Utils/Num.ts
3022
+ // src/Data/Num.ts
3025
3023
  var Num;
3026
3024
  ((Num2) => {
3027
3025
  Num2.range = (from, to, step = 1) => {
@@ -3088,7 +3086,7 @@ var Num;
3088
3086
  };
3089
3087
  })(Num || (Num = {}));
3090
3088
 
3091
- // src/Utils/Rec.ts
3089
+ // src/Data/Rec.ts
3092
3090
  var Rec;
3093
3091
  ((Rec2) => {
3094
3092
  Rec2.map = (f) => (data) => {
@@ -3216,7 +3214,7 @@ var Rec;
3216
3214
  };
3217
3215
  })(Rec || (Rec = {}));
3218
3216
 
3219
- // src/Utils/Str.ts
3217
+ // src/Data/Str.ts
3220
3218
  var Str;
3221
3219
  ((Str2) => {
3222
3220
  Str2.split = (separator) => (s) => s.split(separator);
@@ -3276,7 +3274,7 @@ var Str;
3276
3274
  };
3277
3275
  })(Str || (Str = {}));
3278
3276
 
3279
- // src/Utils/Uniq.ts
3277
+ // src/Data/Uniq.ts
3280
3278
  var Uniq;
3281
3279
  ((Uniq2) => {
3282
3280
  Uniq2.empty = () => new globalThis.Set();
package/dist/index.mjs CHANGED
@@ -35,7 +35,7 @@ import {
35
35
  Rec,
36
36
  Str,
37
37
  Uniq
38
- } from "./chunk-E7YI5PVW.mjs";
38
+ } from "./chunk-BQKKTTJS.mjs";
39
39
  import {
40
40
  Combinable,
41
41
  Deferred,
@@ -61,7 +61,7 @@ import {
61
61
  These,
62
62
  Tuple,
63
63
  Validation
64
- } from "./chunk-M2X7TFKN.mjs";
64
+ } from "./chunk-4R4XUP4M.mjs";
65
65
  import {
66
66
  Brand,
67
67
  Duration,
package/dist/utils.d.mts CHANGED
@@ -523,7 +523,7 @@ declare namespace Arr {
523
523
  *
524
524
  * @example
525
525
  * ```ts
526
- * import { Dict } from "@nlozgachev/pipelined/utils";
526
+ * import { Dict } from "@nlozgachev/pipelined/data";
527
527
  * import { pipe } from "@nlozgachev/pipelined/composition";
528
528
  *
529
529
  * const scores = pipe(
@@ -844,7 +844,7 @@ declare namespace Dict {
844
844
  *
845
845
  * @example
846
846
  * ```ts
847
- * import { Num } from "@nlozgachev/pipelined/utils";
847
+ * import { Num } from "@nlozgachev/pipelined/data";
848
848
  * import { pipe } from "@nlozgachev/pipelined/composition";
849
849
  *
850
850
  * pipe(
@@ -1215,7 +1215,7 @@ declare namespace Rec {
1215
1215
  *
1216
1216
  * @example
1217
1217
  * ```ts
1218
- * import { Str } from "@nlozgachev/pipelined/utils";
1218
+ * import { Str } from "@nlozgachev/pipelined/data";
1219
1219
  * import { pipe } from "@nlozgachev/pipelined/composition";
1220
1220
  *
1221
1221
  * pipe(" Hello, World! ", Str.trim, Str.toLowerCase); // "hello, world!"
@@ -1443,7 +1443,7 @@ declare namespace Str {
1443
1443
  *
1444
1444
  * @example
1445
1445
  * ```ts
1446
- * import { Uniq } from "@nlozgachev/pipelined/utils";
1446
+ * import { Uniq } from "@nlozgachev/pipelined/data";
1447
1447
  * import { pipe } from "@nlozgachev/pipelined/composition";
1448
1448
  *
1449
1449
  * const active = pipe(
package/dist/utils.d.ts CHANGED
@@ -523,7 +523,7 @@ declare namespace Arr {
523
523
  *
524
524
  * @example
525
525
  * ```ts
526
- * import { Dict } from "@nlozgachev/pipelined/utils";
526
+ * import { Dict } from "@nlozgachev/pipelined/data";
527
527
  * import { pipe } from "@nlozgachev/pipelined/composition";
528
528
  *
529
529
  * const scores = pipe(
@@ -844,7 +844,7 @@ declare namespace Dict {
844
844
  *
845
845
  * @example
846
846
  * ```ts
847
- * import { Num } from "@nlozgachev/pipelined/utils";
847
+ * import { Num } from "@nlozgachev/pipelined/data";
848
848
  * import { pipe } from "@nlozgachev/pipelined/composition";
849
849
  *
850
850
  * pipe(
@@ -1215,7 +1215,7 @@ declare namespace Rec {
1215
1215
  *
1216
1216
  * @example
1217
1217
  * ```ts
1218
- * import { Str } from "@nlozgachev/pipelined/utils";
1218
+ * import { Str } from "@nlozgachev/pipelined/data";
1219
1219
  * import { pipe } from "@nlozgachev/pipelined/composition";
1220
1220
  *
1221
1221
  * pipe(" Hello, World! ", Str.trim, Str.toLowerCase); // "hello, world!"
@@ -1443,7 +1443,7 @@ declare namespace Str {
1443
1443
  *
1444
1444
  * @example
1445
1445
  * ```ts
1446
- * import { Uniq } from "@nlozgachev/pipelined/utils";
1446
+ * import { Uniq } from "@nlozgachev/pipelined/data";
1447
1447
  * import { pipe } from "@nlozgachev/pipelined/composition";
1448
1448
  *
1449
1449
  * 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/Utils/index.ts
21
- var Utils_exports = {};
22
- __export(Utils_exports, {
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(Utils_exports);
30
+ module.exports = __toCommonJS(Data_exports);
31
31
 
32
32
  // src/Core/Deferred.ts
33
33
  var Deferred;
@@ -407,7 +407,7 @@ var Task;
407
407
  )(data);
408
408
  })(Task || (Task = {}));
409
409
 
410
- // src/Utils/Arr.ts
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/Utils/Dict.ts
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/Utils/Num.ts
880
+ // src/Data/Num.ts
881
881
  var Num;
882
882
  ((Num2) => {
883
883
  Num2.range = (from, to, step = 1) => {
@@ -944,7 +944,7 @@ var Num;
944
944
  };
945
945
  })(Num || (Num = {}));
946
946
 
947
- // src/Utils/Rec.ts
947
+ // src/Data/Rec.ts
948
948
  var Rec;
949
949
  ((Rec2) => {
950
950
  Rec2.map = (f) => (data) => {
@@ -1072,7 +1072,7 @@ var Rec;
1072
1072
  };
1073
1073
  })(Rec || (Rec = {}));
1074
1074
 
1075
- // src/Utils/Str.ts
1075
+ // src/Data/Str.ts
1076
1076
  var Str;
1077
1077
  ((Str2) => {
1078
1078
  Str2.split = (separator) => (s) => s.split(separator);
@@ -1132,7 +1132,7 @@ var Str;
1132
1132
  };
1133
1133
  })(Str || (Str = {}));
1134
1134
 
1135
- // src/Utils/Uniq.ts
1135
+ // src/Data/Uniq.ts
1136
1136
  var Uniq;
1137
1137
  ((Uniq2) => {
1138
1138
  Uniq2.empty = () => new globalThis.Set();
package/dist/utils.mjs CHANGED
@@ -5,8 +5,8 @@ import {
5
5
  Rec,
6
6
  Str,
7
7
  Uniq
8
- } from "./chunk-E7YI5PVW.mjs";
9
- import "./chunk-M2X7TFKN.mjs";
8
+ } from "./chunk-BQKKTTJS.mjs";
9
+ import "./chunk-4R4XUP4M.mjs";
10
10
  import "./chunk-5AFEEFE4.mjs";
11
11
  export {
12
12
  Arr,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nlozgachev/pipelined",
3
- "version": "0.38.0",
3
+ "version": "0.40.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
- "#utils": "./src/Utils/index.ts",
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"