mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
Remove the isString
helper function
The call-sites are replaced by direct `typeof`-checks instead, which removes unnecessary function calls. Note that in the `src/`-folder we already had more `typeof`-cases than `isString`-calls.
This commit is contained in:
parent
6bd4e0f5af
commit
99cd24ce3e
9 changed files with 47 additions and 75 deletions
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
import { Dict, isName, Name, Ref } from "./primitives.js";
|
||||
import { isString, stringToPDFString, warn } from "../shared/util.js";
|
||||
import { stringToPDFString, warn } from "../shared/util.js";
|
||||
import { NumberTree } from "./name_number_tree.js";
|
||||
|
||||
const MAX_DEPTH = 40;
|
||||
|
@ -295,11 +295,11 @@ class StructTreePage {
|
|||
obj.children = [];
|
||||
parent.children.push(obj);
|
||||
const alt = node.dict.get("Alt");
|
||||
if (isString(alt)) {
|
||||
if (typeof alt === "string") {
|
||||
obj.alt = stringToPDFString(alt);
|
||||
}
|
||||
const lang = node.dict.get("Lang");
|
||||
if (isString(lang)) {
|
||||
if (typeof lang === "string") {
|
||||
obj.lang = stringToPDFString(lang);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue