Remove the isNum 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 `isNum`-calls.

These changes were *mostly* done using regular expression search-and-replace, with two exceptions:
 - In `Font._charToGlyph` we no longer unconditionally update the `width`, since that seems completely unnecessary.
 - In `PDFDocument.documentInfo`, when parsing custom entries, we now do the `typeof`-check once.
This commit is contained in:
Jonas Jenwald 2022-02-22 11:55:34 +01:00
parent edd024c9e7
commit 05edd91bdb
10 changed files with 30 additions and 51 deletions

View file

@ -1034,10 +1034,6 @@ function isBool(v) {
return typeof v === "boolean";
}
function isNum(v) {
return typeof v === "number";
}
function isString(v) {
return typeof v === "string";
}
@ -1146,7 +1142,6 @@ export {
isBool,
IsEvalSupportedCached,
IsLittleEndianCached,
isNum,
isSameOrigin,
isString,
MissingPDFException,