radashi 12.9.5 → 12.9.7
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/radashi.cjs +13 -9
- package/dist/radashi.js +13 -9
- package/package.json +1 -1
package/dist/radashi.cjs
CHANGED
|
@@ -510,12 +510,11 @@ async function parallel(options, array, func) {
|
|
|
510
510
|
if (!next) {
|
|
511
511
|
break;
|
|
512
512
|
}
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
result,
|
|
517
|
-
|
|
518
|
-
});
|
|
513
|
+
try {
|
|
514
|
+
results2.push({ result: await func(next.item), index: next.index });
|
|
515
|
+
} catch (error) {
|
|
516
|
+
results2.push({ error, result: void 0, index: next.index });
|
|
517
|
+
}
|
|
519
518
|
}
|
|
520
519
|
return resolve(results2);
|
|
521
520
|
};
|
|
@@ -535,7 +534,7 @@ async function parallel(options, array, func) {
|
|
|
535
534
|
const itemResults = await (signalPromise ? Promise.race([queues, signalPromise]) : queues);
|
|
536
535
|
const [errors, results] = fork(
|
|
537
536
|
sort(flat(itemResults), (r) => r.index),
|
|
538
|
-
(x) =>
|
|
537
|
+
(x) => "error" in x
|
|
539
538
|
);
|
|
540
539
|
if (errors.length > 0) {
|
|
541
540
|
throw new AggregateErrorOrPolyfill(errors.map((error) => error.error));
|
|
@@ -740,7 +739,12 @@ function memoize(cache, func, keyFunc, ttl) {
|
|
|
740
739
|
};
|
|
741
740
|
}
|
|
742
741
|
function memo(func, options = {}) {
|
|
743
|
-
return memoize(
|
|
742
|
+
return memoize(
|
|
743
|
+
/* @__PURE__ */ Object.create(null),
|
|
744
|
+
func,
|
|
745
|
+
options.key ?? null,
|
|
746
|
+
options.ttl ?? null
|
|
747
|
+
);
|
|
744
748
|
}
|
|
745
749
|
|
|
746
750
|
// src/curry/memoLastCall.ts
|
|
@@ -936,7 +940,7 @@ function* range(startOrLength, end, valueOrMapper = (i) => i, step = 1) {
|
|
|
936
940
|
|
|
937
941
|
// src/number/round.ts
|
|
938
942
|
function round(value, precision, toInteger = Math.round) {
|
|
939
|
-
if (precision) {
|
|
943
|
+
if (precision && Number.isFinite(value)) {
|
|
940
944
|
const p = precision > 0 ? Math.min(precision, 292) : Math.max(precision, -323);
|
|
941
945
|
let [q, e] = `${value}e`.split("e");
|
|
942
946
|
[q, e] = `${toInteger(+`${q}e${+e + p}`)}e`.split("e");
|
package/dist/radashi.js
CHANGED
|
@@ -508,12 +508,11 @@ async function parallel(options, array, func) {
|
|
|
508
508
|
if (!next) {
|
|
509
509
|
break;
|
|
510
510
|
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
result,
|
|
515
|
-
|
|
516
|
-
});
|
|
511
|
+
try {
|
|
512
|
+
results2.push({ result: await func(next.item), index: next.index });
|
|
513
|
+
} catch (error) {
|
|
514
|
+
results2.push({ error, result: void 0, index: next.index });
|
|
515
|
+
}
|
|
517
516
|
}
|
|
518
517
|
return resolve(results2);
|
|
519
518
|
};
|
|
@@ -533,7 +532,7 @@ async function parallel(options, array, func) {
|
|
|
533
532
|
const itemResults = await (signalPromise ? Promise.race([queues, signalPromise]) : queues);
|
|
534
533
|
const [errors, results] = fork(
|
|
535
534
|
sort(flat(itemResults), (r) => r.index),
|
|
536
|
-
(x) =>
|
|
535
|
+
(x) => "error" in x
|
|
537
536
|
);
|
|
538
537
|
if (errors.length > 0) {
|
|
539
538
|
throw new AggregateErrorOrPolyfill(errors.map((error) => error.error));
|
|
@@ -738,7 +737,12 @@ function memoize(cache, func, keyFunc, ttl) {
|
|
|
738
737
|
};
|
|
739
738
|
}
|
|
740
739
|
function memo(func, options = {}) {
|
|
741
|
-
return memoize(
|
|
740
|
+
return memoize(
|
|
741
|
+
/* @__PURE__ */ Object.create(null),
|
|
742
|
+
func,
|
|
743
|
+
options.key ?? null,
|
|
744
|
+
options.ttl ?? null
|
|
745
|
+
);
|
|
742
746
|
}
|
|
743
747
|
|
|
744
748
|
// src/curry/memoLastCall.ts
|
|
@@ -934,7 +938,7 @@ function* range(startOrLength, end, valueOrMapper = (i) => i, step = 1) {
|
|
|
934
938
|
|
|
935
939
|
// src/number/round.ts
|
|
936
940
|
function round(value, precision, toInteger = Math.round) {
|
|
937
|
-
if (precision) {
|
|
941
|
+
if (precision && Number.isFinite(value)) {
|
|
938
942
|
const p = precision > 0 ? Math.min(precision, 292) : Math.max(precision, -323);
|
|
939
943
|
let [q, e] = `${value}e`.split("e");
|
|
940
944
|
[q, e] = `${toInteger(+`${q}e${+e + p}`)}e`.split("e");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "radashi",
|
|
3
|
-
"version": "12.9.
|
|
3
|
+
"version": "12.9.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The modern, community-first TypeScript toolkit with all of the fast, readable, and minimal utility functions you need. Type-safe, dependency-free, tree-shakeable, fully tested.",
|
|
6
6
|
"repository": {
|