mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-09 23:04:02 +02:00
Use Map.prototype.getOrInsert() in the #collectParents method
This commit is contained in:
parent
f548a159d6
commit
3e7ad8d6bf
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user