Use Map.prototype.getOrInsert() in the #collectParents method

This commit is contained in:
Jonas Jenwald 2026-02-21 11:42:42 +01:00
parent f548a159d6
commit 3e7ad8d6bf

View File

@ -450,12 +450,7 @@ class StructTreeRoot {
for (const element of elements) {
if (element.structTreeParentId) {
const id = parseInt(element.structTreeParentId.split("_mc")[1], 10);
let elems = idToElements.get(id);
if (!elems) {
elems = [];
idToElements.set(id, elems);
}
elems.push(element);
idToElements.getOrInsert(id, []).push(element);
}
}