radashi 12.9.6 → 12.9.8

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 CHANGED
@@ -510,12 +510,11 @@ async function parallel(options, array, func) {
510
510
  if (!next) {
511
511
  break;
512
512
  }
513
- const [error, result] = await tryit(func)(next.item);
514
- results2.push({
515
- error,
516
- result,
517
- index: next.index
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) => !!x.error
537
+ (x) => "error" in x
539
538
  );
540
539
  if (errors.length > 0) {
541
540
  throw new AggregateErrorOrPolyfill(errors.map((error) => error.error));
@@ -941,7 +940,7 @@ function* range(startOrLength, end, valueOrMapper = (i) => i, step = 1) {
941
940
 
942
941
  // src/number/round.ts
943
942
  function round(value, precision, toInteger = Math.round) {
944
- if (precision) {
943
+ if (precision && Number.isFinite(value)) {
945
944
  const p = precision > 0 ? Math.min(precision, 292) : Math.max(precision, -323);
946
945
  let [q, e] = `${value}e`.split("e");
947
946
  [q, e] = `${toInteger(+`${q}e${+e + p}`)}e`.split("e");
@@ -975,6 +974,9 @@ function assign(initial, override) {
975
974
  const proto = Object.getPrototypeOf(initial);
976
975
  const merged = proto ? { ...initial } : Object.assign(Object.create(proto), initial);
977
976
  for (const key of Object.keys(override)) {
977
+ if (isDangerousKey(key, merged)) {
978
+ continue;
979
+ }
978
980
  merged[key] = isPlainObject(initial[key]) && isPlainObject(override[key]) ? assign(initial[key], override[key]) : override[key];
979
981
  }
980
982
  return merged;
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
- const [error, result] = await tryit(func)(next.item);
512
- results2.push({
513
- error,
514
- result,
515
- index: next.index
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) => !!x.error
535
+ (x) => "error" in x
537
536
  );
538
537
  if (errors.length > 0) {
539
538
  throw new AggregateErrorOrPolyfill(errors.map((error) => error.error));
@@ -939,7 +938,7 @@ function* range(startOrLength, end, valueOrMapper = (i) => i, step = 1) {
939
938
 
940
939
  // src/number/round.ts
941
940
  function round(value, precision, toInteger = Math.round) {
942
- if (precision) {
941
+ if (precision && Number.isFinite(value)) {
943
942
  const p = precision > 0 ? Math.min(precision, 292) : Math.max(precision, -323);
944
943
  let [q, e] = `${value}e`.split("e");
945
944
  [q, e] = `${toInteger(+`${q}e${+e + p}`)}e`.split("e");
@@ -973,6 +972,9 @@ function assign(initial, override) {
973
972
  const proto = Object.getPrototypeOf(initial);
974
973
  const merged = proto ? { ...initial } : Object.assign(Object.create(proto), initial);
975
974
  for (const key of Object.keys(override)) {
975
+ if (isDangerousKey(key, merged)) {
976
+ continue;
977
+ }
976
978
  merged[key] = isPlainObject(initial[key]) && isPlainObject(override[key]) ? assign(initial[key], override[key]) : override[key];
977
979
  }
978
980
  return merged;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "radashi",
3
- "version": "12.9.6",
3
+ "version": "12.9.8",
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": {