From 20cbb894125c5e58e0481dbdc0b1fe2e761a2cbe Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Mon, 27 Mar 2023 11:34:20 +0200 Subject: [PATCH] Simplify the `isPDFFunction` helper function Originally we used helper functions for checking if something was a Dictionary or Stream, and then having an initial `typeof` check probably made sense. However, given that we're using `instanceof` nowadays the additional check longer seems necessary. --- src/core/function.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/core/function.js b/src/core/function.js index acce24feb..a9292b88f 100644 --- a/src/core/function.js +++ b/src/core/function.js @@ -502,9 +502,7 @@ class PDFFunction { function isPDFFunction(v) { let fnDict; - if (typeof v !== "object") { - return false; - } else if (v instanceof Dict) { + if (v instanceof Dict) { fnDict = v; } else if (v instanceof BaseStream) { fnDict = v.dict;