@typeberry/convert 0.5.8 → 0.5.9-927395c

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.
Files changed (3) hide show
  1. package/index.js +15 -4
  2. package/index.js.map +1 -1
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -4500,6 +4500,12 @@ function assertEmpty(value) {
4500
4500
  }
4501
4501
  /** Debug print an object. */
4502
4502
  function debug_inspect(val) {
4503
+ return inspectInternal(val, new WeakSet());
4504
+ }
4505
+ /**
4506
+ * Internal implementation of inspect with circular reference detection.
4507
+ */
4508
+ function inspectInternal(val, seen) {
4503
4509
  const nest = (v) => v
4504
4510
  .split("\n")
4505
4511
  .map((x) => ` ${x}`)
@@ -4512,10 +4518,10 @@ function debug_inspect(val) {
4512
4518
  return "<undefined>";
4513
4519
  }
4514
4520
  if (Array.isArray(val)) {
4515
- return `[${val.map((x) => debug_inspect(x))}]`;
4521
+ return `[${val.map((x) => inspectInternal(x, seen))}]`;
4516
4522
  }
4517
4523
  if (val instanceof Map) {
4518
- return debug_inspect(Array.from(val.entries()));
4524
+ return inspectInternal(Array.from(val.entries()), seen);
4519
4525
  }
4520
4526
  if (typeof val === "number") {
4521
4527
  return `${val} (0x${val.toString(16)})`;
@@ -4523,6 +4529,11 @@ function debug_inspect(val) {
4523
4529
  if (typeof val !== "object") {
4524
4530
  return `${val}`;
4525
4531
  }
4532
+ // Check for circular references
4533
+ if (seen.has(val)) {
4534
+ return "<circular>";
4535
+ }
4536
+ seen.add(val);
4526
4537
  if ("toString" in val &&
4527
4538
  Object.prototype.toString !== val.toString &&
4528
4539
  WithDebug.prototype.toString !== val.toString) {
@@ -4535,7 +4546,7 @@ function debug_inspect(val) {
4535
4546
  for (const k of keys) {
4536
4547
  if (typeof k === "string") {
4537
4548
  v += oneLine ? "" : "\n ";
4538
- v += `${k}: ${nest(debug_inspect(val[k]))}`;
4549
+ v += `${k}: ${nest(inspectInternal(val[k], seen))}`;
4539
4550
  v += oneLine ? "," : "";
4540
4551
  }
4541
4552
  }
@@ -4615,7 +4626,7 @@ function seeThrough(v) {
4615
4626
  }
4616
4627
 
4617
4628
  ;// CONCATENATED MODULE: ./packages/core/utils/package.json
4618
- const package_namespaceObject = {"rE":"0.5.8"};
4629
+ const package_namespaceObject = {"rE":"0.5.9"};
4619
4630
  ;// CONCATENATED MODULE: ./packages/core/utils/result.ts
4620
4631
 
4621
4632
  /**