@typeberry/convert 0.5.2-03e1aed → 0.5.2-9afefa7

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/index.js CHANGED
@@ -8133,14 +8133,14 @@ class BlobDictionary extends WithDebug {
8133
8133
  const pathChunksGenerator = key.chunks(CHUNK_SIZE);
8134
8134
  let depth = 0;
8135
8135
  while (node !== undefined) {
8136
- const maybePathChunk = pathChunksGenerator.next().value;
8137
8136
  if (node.children instanceof ListChildren) {
8138
- const subkey = bytes_BytesBlob.blobFrom(key.raw.subarray(depth * CHUNK_SIZE));
8137
+ const subkey = depth === 0 ? key : bytes_BytesBlob.blobFrom(key.raw.subarray(depth * CHUNK_SIZE));
8139
8138
  const child = node.children.find(subkey);
8140
8139
  if (child !== null) {
8141
8140
  return child.value;
8142
8141
  }
8143
8142
  }
8143
+ const maybePathChunk = pathChunksGenerator.next().value;
8144
8144
  if (maybePathChunk === undefined) {
8145
8145
  return node.getLeaf()?.value;
8146
8146
  }
@@ -8324,7 +8324,7 @@ class ListChildren {
8324
8324
  children = [];
8325
8325
  constructor() { }
8326
8326
  find(key) {
8327
- const result = this.children.find((item) => item[0].isEqualTo(key));
8327
+ const result = this.children.find((item) => item[0] === key || item[0].isEqualTo(key));
8328
8328
  if (result !== undefined) {
8329
8329
  return result[1];
8330
8330
  }