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:
parent
3c93d63731
commit
532406427b
@ -551,10 +551,7 @@ class StructElementNode {
|
||||
const nameObj = this.dict.get("S");
|
||||
const name = nameObj instanceof Name ? nameObj.name : "";
|
||||
const { root } = this.tree;
|
||||
if (root.roleMap.has(name)) {
|
||||
return root.roleMap.get(name);
|
||||
}
|
||||
return name;
|
||||
return root.roleMap.get(name) ?? name;
|
||||
}
|
||||
|
||||
parseKids() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user