1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

Remove the isRef helper function

This helper function is not really needed, since it's just a wrapper around a simple `instanceof` check, and it only adds unnecessary indirection in the code.
This commit is contained in:
Jonas Jenwald 2022-02-18 12:11:45 +01:00
parent df0aa1a9c4
commit 2cb2f633ac
10 changed files with 55 additions and 67 deletions

View file

@ -14,7 +14,7 @@
*/
import { bytesToString, escapeString, warn } from "../shared/util.js";
import { Dict, isDict, isName, isRef, Name } from "./primitives.js";
import { Dict, isDict, isName, Name, Ref } from "./primitives.js";
import { escapePDFName, parseXFAPath } from "./core_utils.js";
import { SimpleDOMNode, SimpleXMLParser } from "./xml_parser.js";
import { BaseStream } from "./base_stream.js";
@ -73,7 +73,7 @@ function numberToString(value) {
function writeValue(value, buffer, transform) {
if (isName(value)) {
buffer.push(`/${escapePDFName(value.name)}`);
} else if (isRef(value)) {
} else if (value instanceof Ref) {
buffer.push(`${value.num} ${value.gen} R`);
} else if (Array.isArray(value)) {
writeArray(value, buffer, transform);