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
|
@ -24,7 +24,6 @@ import {
|
|||
IDENTITY_MATRIX,
|
||||
info,
|
||||
isArrayEqual,
|
||||
isString,
|
||||
OPS,
|
||||
shadow,
|
||||
stringToPDFString,
|
||||
|
@ -1784,7 +1783,7 @@ class PartialEvaluator {
|
|||
var state = stateManager.state;
|
||||
for (i = 0; i < arrLength; ++i) {
|
||||
const arrItem = arr[i];
|
||||
if (isString(arrItem)) {
|
||||
if (typeof arrItem === "string") {
|
||||
Array.prototype.push.apply(
|
||||
combinedGlyphs,
|
||||
self.handleText(arrItem, state)
|
||||
|
@ -3974,10 +3973,10 @@ class PartialEvaluator {
|
|||
let fontName = descriptor.get("FontName");
|
||||
let baseFont = dict.get("BaseFont");
|
||||
// Some bad PDFs have a string as the font name.
|
||||
if (isString(fontName)) {
|
||||
if (typeof fontName === "string") {
|
||||
fontName = Name.get(fontName);
|
||||
}
|
||||
if (isString(baseFont)) {
|
||||
if (typeof baseFont === "string") {
|
||||
baseFont = Name.get(baseFont);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue