Remove the isStream helper function

At this point all the various Stream-classes extends an abstract base-class, hence this helper function is no longer necessary and only adds unnecessary indirection in the code.
This commit is contained in:
Jonas Jenwald 2022-02-17 13:45:42 +01:00
parent d9a3a24353
commit 1a31855977
15 changed files with 51 additions and 80 deletions

View file

@ -23,8 +23,8 @@ import {
Util,
warn,
} from "../shared/util.js";
import { BaseStream } from "./base_stream.js";
import { ColorSpace } from "./colorspace.js";
import { isStream } from "./primitives.js";
import { MissingDataException } from "./core_utils.js";
const ShadingType = {
@ -50,7 +50,7 @@ class Pattern {
pdfFunctionFactory,
localColorSpaceCache
) {
const dict = isStream(shading) ? shading.dict : shading;
const dict = shading instanceof BaseStream ? shading.dict : shading;
const type = dict.get("ShadingType");
try {
@ -403,7 +403,7 @@ class MeshShading extends BaseShading {
localColorSpaceCache
) {
super();
if (!isStream(stream)) {
if (!(stream instanceof BaseStream)) {
throw new FormatError("Mesh data is not a stream");
}
const dict = stream.dict;