@accumulators/merkle-mountain-range
Advanced tools
Comparing version 4.0.2 to 4.1.0-alpha.0
@@ -82,18 +82,14 @@ "use strict"; | ||
async getMany(idxs) { | ||
const chunks = idxs.reduce((chunks, suffix) => { | ||
const key = this.agnosticGetKey(suffix); | ||
if (key.startsWith(this.key)) { | ||
if (!chunks.length || chunks[chunks.length - 1].table === "parent") | ||
chunks.push({ table: "self", keys: [] }); | ||
chunks[chunks.length - 1].keys.push(key); | ||
} | ||
else { | ||
if (!chunks.length || chunks[chunks.length - 1].table === "self") | ||
chunks.push({ table: "parent", keys: [] }); | ||
chunks[chunks.length - 1].keys.push(key); | ||
} | ||
return chunks; | ||
}, []); | ||
const keyed = await Promise.all(chunks.map(({ table, keys }) => (table === "self" ? this.store : this.parentTable.store).getMany(keys))); | ||
const keyless = keyed | ||
const keys = idxs.map((suffix) => this.agnosticGetKey(suffix)); | ||
const [thisTable, parentTable] = keys.reduce(([thisTable, parentTable], key) => { | ||
if (key.startsWith(this.key)) | ||
thisTable.push(key); | ||
else | ||
parentTable.push(key); | ||
return [thisTable, parentTable]; | ||
}, [[], []]); | ||
const keyless = (await Promise.all([ | ||
thisTable.length ? this.store.getMany(thisTable) : Promise.resolve(new Map()), | ||
parentTable.length ? this.parentTable.store.getMany(parentTable) : Promise.resolve(new Map()), | ||
])) | ||
.reduce((acc, map) => [...acc, ...map], []) | ||
@@ -100,0 +96,0 @@ .reduce((acc, [key, value]) => acc.set(key.split(":").slice(2).join(":"), value), new Map()); |
{ | ||
"name": "@accumulators/merkle-mountain-range", | ||
"version": "4.0.2", | ||
"version": "4.1.0-alpha.0", | ||
"description": "A TypeScript implementation of Merkle Mountain Ranges", | ||
@@ -36,10 +36,10 @@ "keywords": [ | ||
"dependencies": { | ||
"@accumulators/core": "^4.0.1", | ||
"@accumulators/core": "^4.0.0", | ||
"ulid": "^2.3.0" | ||
}, | ||
"devDependencies": { | ||
"@accumulators/hashers": "^4.0.1", | ||
"@accumulators/memory": "^4.0.1" | ||
"@accumulators/hashers": "^4.1.0-alpha.0", | ||
"@accumulators/memory": "^4.0.0" | ||
}, | ||
"gitHead": "827b393560007704bef578591fab9a56db1d1d70" | ||
"gitHead": "dda00bf0d093363078e7d9f675476a6cca079454" | ||
} |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
67629
38
843
1
Updated@accumulators/core@^4.0.0