1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

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 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() {