Simplify the StructElementNode.prototype.role getter a tiny bit

Given that the `roleMap` only contains `Name`-strings, the lookup can be simplified thanks to modern JavaScript features.
This commit is contained in:
Jonas Jenwald 2025-03-25 10:03:15 +01:00
parent 3c93d63731
commit 532406427b

View File

@ -551,10 +551,7 @@ class StructElementNode {
const nameObj = this.dict.get("S"); const nameObj = this.dict.get("S");
const name = nameObj instanceof Name ? nameObj.name : ""; const name = nameObj instanceof Name ? nameObj.name : "";
const { root } = this.tree; const { root } = this.tree;
if (root.roleMap.has(name)) { return root.roleMap.get(name) ?? name;
return root.roleMap.get(name);
}
return name;
} }
parseKids() { parseKids() {