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:
parent
3c93d63731
commit
532406427b
1 changed files with 1 additions and 4 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue