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

Prefer instanceof Dict rather than calling isDict() with one argument

Unless you actually need to check that something is both a `Dict` and also of the *correct* type, using `instanceof Dict` directly should be a tiny bit more efficient since it avoids one function call and an unnecessary `undefined` check.

This patch uses ESLint to enforce this, since we obviously still want to keep the `isDict` helper function for where it makes sense.
This commit is contained in:
Jonas Jenwald 2022-02-21 12:44:56 +01:00
parent 67b658e8d5
commit 4df82ad31e
18 changed files with 83 additions and 93 deletions

View file

@ -13,9 +13,9 @@
* limitations under the License.
*/
import { Dict, isDict } from "./primitives.js";
import { CCITTFaxDecoder } from "./ccitt.js";
import { DecodeStream } from "./decode_stream.js";
import { Dict } from "./primitives.js";
class CCITTFaxStream extends DecodeStream {
constructor(str, maybeLength, params) {
@ -24,7 +24,7 @@ class CCITTFaxStream extends DecodeStream {
this.str = str;
this.dict = str.dict;
if (!isDict(params)) {
if (!(params instanceof Dict)) {
params = Dict.empty;
}