Merge pull request #8864 from Snuffleupagus/rm-isArray

Replace the `isArray` helper function with the native `Array.isArray` function
This commit is contained in:
Tim van der Meij 2017-09-01 23:08:44 +02:00 committed by GitHub
commit 336d26dd13
17 changed files with 77 additions and 87 deletions

View File

@ -15,7 +15,7 @@
import {
AnnotationBorderStyleType, AnnotationFieldFlag, AnnotationFlag,
AnnotationType, isArray, OPS, stringToBytes, stringToPDFString, Util, warn
AnnotationType, OPS, stringToBytes, stringToPDFString, Util, warn
} from '../shared/util';
import { Catalog, FileSpec, ObjectLoader } from './obj';
import { Dict, isDict, isName, isRef, isStream } from './primitives';
@ -236,7 +236,7 @@ class Annotation {
* @param {Array} rectangle - The rectangle array with exactly four entries
*/
setRectangle(rectangle) {
if (isArray(rectangle) && rectangle.length === 4) {
if (Array.isArray(rectangle) && rectangle.length === 4) {
this.rectangle = Util.normalizeRect(rectangle);
} else {
this.rectangle = [0, 0, 0, 0];
@ -254,7 +254,7 @@ class Annotation {
*/
setColor(color) {
let rgbColor = new Uint8Array(3); // Black in RGB color space (default)
if (!isArray(color)) {
if (!Array.isArray(color)) {
this.color = rgbColor;
return;
}
@ -308,7 +308,7 @@ class Annotation {
}
} else if (borderStyle.has('Border')) {
let array = borderStyle.getArray('Border');
if (isArray(array) && array.length >= 3) {
if (Array.isArray(array) && array.length >= 3) {
this.borderStyle.setHorizontalCornerRadius(array[0]);
this.borderStyle.setVerticalCornerRadius(array[1]);
this.borderStyle.setWidth(array[2]);
@ -504,7 +504,7 @@ class AnnotationBorderStyle {
// We validate the dash array, but we do not use it because CSS does not
// allow us to change spacing of dashes. For more information, visit
// http://www.w3.org/TR/css3-background/#the-border-style.
if (isArray(dashArray) && dashArray.length > 0) {
if (Array.isArray(dashArray) && dashArray.length > 0) {
// According to the PDF specification: the elements in `dashArray`
// shall be numbers that are nonnegative and not all equal to zero.
let isValid = true;
@ -775,11 +775,11 @@ class ChoiceWidgetAnnotation extends WidgetAnnotation {
this.data.options = [];
let options = Util.getInheritableProperty(params.dict, 'Opt');
if (isArray(options)) {
if (Array.isArray(options)) {
let xref = params.xref;
for (let i = 0, ii = options.length; i < ii; i++) {
let option = xref.fetchIfRef(options[i]);
let isOptionArray = isArray(option);
let isOptionArray = Array.isArray(option);
this.data.options[i] = {
exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,
@ -791,7 +791,7 @@ class ChoiceWidgetAnnotation extends WidgetAnnotation {
// Determine the field value. In this case, it may be a string or an
// array of strings. For convenience in the display layer, convert the
// string to an array of one string as well.
if (!isArray(this.data.fieldValue)) {
if (!Array.isArray(this.data.fieldValue)) {
this.data.fieldValue = [this.data.fieldValue];
}

View File

@ -14,7 +14,7 @@
*/
import {
bytesToString, FormatError, info, isArray, stringToBytes, Util, warn
bytesToString, FormatError, info, stringToBytes, Util, warn
} from '../shared/util';
import {
ExpertCharset, ExpertSubsetCharset, ISOAdobeCharset
@ -676,7 +676,7 @@ var CFFParser = (function CFFParserClosure() {
}
var privateOffset = parentDict.getByName('Private');
// make sure the params are formatted correctly
if (!isArray(privateOffset) || privateOffset.length !== 2) {
if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
parentDict.removeByName('Private');
return;
}
@ -1037,12 +1037,13 @@ var CFFDict = (function CFFDictClosure() {
};
for (var i = 0, ii = layout.length; i < ii; ++i) {
var entry = layout[i];
var key = isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
var key = Array.isArray(entry[0]) ?
(entry[0][0] << 8) + entry[0][1] : entry[0];
tables.keyToNameMap[key] = entry[1];
tables.nameToKeyMap[entry[1]] = key;
tables.types[key] = entry[2];
tables.defaults[key] = entry[3];
tables.opcodes[key] = isArray(entry[0]) ? entry[0] : [entry[0]];
tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
tables.order.push(key);
}
return tables;
@ -1487,10 +1488,10 @@ var CFFCompiler = (function CFFCompilerClosure() {
}
var values = dict.values[key];
var types = dict.types[key];
if (!isArray(types)) {
if (!Array.isArray(types)) {
types = [types];
}
if (!isArray(values)) {
if (!Array.isArray(values)) {
values = [values];
}

View File

@ -13,9 +13,7 @@
* limitations under the License.
*/
import {
FormatError, info, isArray, isString, shadow, warn
} from '../shared/util';
import { FormatError, info, isString, shadow, warn } from '../shared/util';
import { isDict, isName, isStream } from './primitives';
import { PDFFunction } from './function';
@ -211,7 +209,7 @@ var ColorSpace = (function ColorSpaceClosure() {
};
ColorSpace.fromIR = function ColorSpace_fromIR(IR) {
var name = isArray(IR) ? IR[0] : IR;
var name = Array.isArray(IR) ? IR[0] : IR;
var whitePoint, blackPoint, gamma;
switch (name) {
@ -289,7 +287,7 @@ var ColorSpace = (function ColorSpaceClosure() {
throw new FormatError(`unrecognized colorspace ${cs.name}`);
}
}
if (isArray(cs)) {
if (Array.isArray(cs)) {
var mode = xref.fetchIfRef(cs[0]).name;
var numComps, params, alt, whitePoint, blackPoint, gamma;
@ -357,7 +355,7 @@ var ColorSpace = (function ColorSpaceClosure() {
case 'Separation':
case 'DeviceN':
var name = xref.fetchIfRef(cs[1]);
numComps = isArray(name) ? name.length : 1;
numComps = Array.isArray(name) ? name.length : 1;
alt = ColorSpace.parseToIR(cs[2], xref, res);
var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3]));
return ['AlternateCS', numComps, alt, tintFnIR];
@ -383,7 +381,7 @@ var ColorSpace = (function ColorSpaceClosure() {
* @param {Number} n Number of components the color space has.
*/
ColorSpace.isDefaultDecode = function ColorSpace_isDefaultDecode(decode, n) {
if (!isArray(decode)) {
if (!Array.isArray(decode)) {
return true;
}

View File

@ -16,8 +16,8 @@
import { Catalog, ObjectLoader, XRef } from './obj';
import { Dict, isDict, isName, isStream } from './primitives';
import {
info, isArray, isArrayBuffer, isNum, isSpace, isString, MissingDataException,
OPS, shadow, stringToBytes, stringToPDFString, Util, warn
info, isArrayBuffer, isNum, isSpace, isString, MissingDataException, OPS,
shadow, stringToBytes, stringToPDFString, Util, warn
} from '../shared/util';
import { NullStream, Stream, StreamsSequenceStream } from './stream';
import { OperatorList, PartialEvaluator } from './evaluator';
@ -107,7 +107,7 @@ var Page = (function PageClosure() {
get mediaBox() {
var mediaBox = this.getInheritedPageProp('MediaBox', true);
// Reset invalid media box to letter size.
if (!isArray(mediaBox) || mediaBox.length !== 4) {
if (!Array.isArray(mediaBox) || mediaBox.length !== 4) {
return shadow(this, 'mediaBox', LETTER_SIZE_MEDIABOX);
}
return shadow(this, 'mediaBox', mediaBox);
@ -116,7 +116,7 @@ var Page = (function PageClosure() {
get cropBox() {
var cropBox = this.getInheritedPageProp('CropBox', true);
// Reset invalid crop box to media box.
if (!isArray(cropBox) || cropBox.length !== 4) {
if (!Array.isArray(cropBox) || cropBox.length !== 4) {
return shadow(this, 'cropBox', this.mediaBox);
}
return shadow(this, 'cropBox', cropBox);
@ -161,7 +161,7 @@ var Page = (function PageClosure() {
getContentStream: function Page_getContentStream() {
var content = this.content;
var stream;
if (isArray(content)) {
if (Array.isArray(content)) {
// fetching items
var xref = this.xref;
var i, n = content.length;
@ -413,7 +413,7 @@ var PDFDocument = (function PDFDocumentClosure() {
if (this.acroForm) {
this.xfa = this.acroForm.get('XFA');
var fields = this.acroForm.get('Fields');
if ((!fields || !isArray(fields) || fields.length === 0) &&
if ((!fields || !Array.isArray(fields) || fields.length === 0) &&
!this.xfa) {
// no fields and no XFA -- not a form (?)
this.acroForm = null;
@ -576,7 +576,7 @@ var PDFDocument = (function PDFDocumentClosure() {
var xref = this.xref, hash, fileID = '';
var idArray = xref.trailer.get('ID');
if (idArray && isArray(idArray) && idArray[0] && isString(idArray[0]) &&
if (Array.isArray(idArray) && idArray[0] && isString(idArray[0]) &&
idArray[0] !== EMPTY_FINGERPRINT) {
hash = stringToBytes(idArray[0]);
} else {

View File

@ -16,8 +16,8 @@
import {
AbortException, assert, CMapCompressionType, createPromiseCapability,
FONT_IDENTITY_MATRIX, FormatError, getLookupTableFactory, IDENTITY_MATRIX,
ImageKind, info, isArray, isNum, isString, NativeImageDecoding, OPS,
TextRenderingMode, UNSUPPORTED_FEATURES, Util, warn
ImageKind, info, isNum, isString, NativeImageDecoding, OPS, TextRenderingMode,
UNSUPPORTED_FEATURES, Util, warn
} from '../shared/util';
import { CMapFactory, IdentityCMap } from './cmap';
import { DecodeStream, JpegStream, Stream } from './stream';
@ -1663,7 +1663,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
var xObjStateManager = new StateManager(currentState);
var matrix = xobj.dict.getArray('Matrix');
if (isArray(matrix) && matrix.length === 6) {
if (Array.isArray(matrix) && matrix.length === 6) {
xObjStateManager.transform(matrix);
}
@ -2089,7 +2089,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
for (i = 0, ii = widths.length; i < ii; i++) {
start = xref.fetchIfRef(widths[i++]);
code = xref.fetchIfRef(widths[i]);
if (isArray(code)) {
if (Array.isArray(code)) {
for (j = 0, jj = code.length; j < jj; j++) {
glyphsWidths[start++] = xref.fetchIfRef(code[j]);
}
@ -2110,7 +2110,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
for (i = 0, ii = vmetrics.length; i < ii; i++) {
start = xref.fetchIfRef(vmetrics[i++]);
code = xref.fetchIfRef(vmetrics[i]);
if (isArray(code)) {
if (Array.isArray(code)) {
for (j = 0, jj = code.length; j < jj; j++) {
glyphsVMetrics[start++] = [
xref.fetchIfRef(code[j++]),
@ -2258,7 +2258,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
if (!df) {
throw new FormatError('Descendant fonts are not specified');
}
dict = (isArray(df) ? this.xref.fetchIfRef(df[0]) : df);
dict = (Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df);
type = dict.get('Subtype');
if (!isName(type)) {
@ -2283,7 +2283,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
hash.update(entry.name);
} else if (isRef(entry)) {
hash.update(entry.toString());
} else if (isArray(entry)) {
} else if (Array.isArray(entry)) {
// 'Differences' array (fixes bug1157493.pdf).
var diffLength = entry.length, diffBuf = new Array(diffLength);

View File

@ -14,8 +14,8 @@
*/
import {
bytesToString, FONT_IDENTITY_MATRIX, FontType, FormatError, info, isArray,
isNum, isSpace, MissingDataException, readUint32, shadow, string32, warn
bytesToString, FONT_IDENTITY_MATRIX, FontType, FormatError, info, isNum,
isSpace, MissingDataException, readUint32, shadow, string32, warn
} from '../shared/util';
import {
CFF, CFFCharset, CFFCompiler, CFFHeader, CFFIndex, CFFParser, CFFPrivateDict,
@ -3250,7 +3250,7 @@ var Type1Font = (function Type1FontClosure() {
continue;
}
var value = properties.privateData[field];
if (isArray(value)) {
if (Array.isArray(value)) {
// All of the private dictionary array data in CFF must be stored as
// "delta-encoded" numbers.
for (var j = value.length - 1; j > 0; j--) {

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { FormatError, info, isArray, isBool } from '../shared/util';
import { FormatError, info, isBool } from '../shared/util';
import { isDict, isStream } from './primitives';
import { PostScriptLexer, PostScriptParser } from './ps_parser';
@ -96,7 +96,7 @@ var PDFFunction = (function PDFFunctionClosure() {
},
parseArray: function PDFFunction_parseArray(xref, fnObj) {
if (!isArray(fnObj)) {
if (!Array.isArray(fnObj)) {
// not an array -- parsing as regular function
return this.parse(xref, fnObj);
}
@ -262,7 +262,7 @@ var PDFFunction = (function PDFFunctionClosure() {
var c1 = dict.getArray('C1') || [1];
var n = dict.get('N');
if (!isArray(c0) || !isArray(c1)) {
if (!Array.isArray(c0) || !Array.isArray(c1)) {
throw new FormatError(
'Illegal dictionary for interpolated function');
}

View File

@ -13,9 +13,7 @@
* limitations under the License.
*/
import {
assert, FormatError, ImageKind, info, isArray, warn
} from '../shared/util';
import { assert, FormatError, ImageKind, info, warn } from '../shared/util';
import { DecodeStream, JpegStream } from './stream';
import { isStream, Name } from './primitives';
import { ColorSpace } from './colorspace';
@ -199,7 +197,7 @@ var PDFImage = (function PDFImageClosure() {
if (mask) {
if (isStream(mask)) {
maskPromise = handleImageData(mask, nativeDecoder);
} else if (isArray(mask)) {
} else if (Array.isArray(mask)) {
maskPromise = Promise.resolve(mask);
} else {
warn('Unsupported mask format.');
@ -408,7 +406,7 @@ var PDFImage = (function PDFImageClosure() {
alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh,
width, height);
}
} else if (isArray(mask)) {
} else if (Array.isArray(mask)) {
// Color key mask: if any of the components are outside the range
// then they should be painted.
alphaBuf = new Uint8Array(width * height);

View File

@ -15,8 +15,8 @@
import {
bytesToString, createPromiseCapability, createValidAbsoluteUrl, FormatError,
info, InvalidPDFException, isArray, isBool, isString, MissingDataException,
shadow, stringToPDFString, stringToUTF8String, Util, warn, XRefParseException
info, InvalidPDFException, isBool, isString, MissingDataException, shadow,
stringToPDFString, stringToUTF8String, Util, warn, XRefParseException
} from '../shared/util';
import {
Dict, isCmd, isDict, isName, isRef, isRefsEqual, isStream, Ref, RefSet,
@ -136,7 +136,7 @@ var Catalog = (function CatalogClosure() {
var color = outlineDict.getArray('C'), rgbColor = blackColor;
// We only need to parse the color when it's valid, and non-default.
if (isArray(color) && color.length === 3 &&
if (Array.isArray(color) && color.length === 3 &&
(color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
rgbColor = ColorSpace.singletons.rgb.getRgb(color, 0);
}
@ -507,7 +507,7 @@ var Catalog = (function CatalogClosure() {
}
var kids = currentNode.get('Kids');
if (!isArray(kids)) {
if (!Array.isArray(kids)) {
capability.reject(new FormatError(
'page dictionary kids object is not an array'));
return;
@ -707,7 +707,7 @@ var Catalog = (function CatalogClosure() {
let baseUrl = url.split('#')[0];
if (isString(remoteDest)) {
url = baseUrl + '#' + remoteDest;
} else if (isArray(remoteDest)) {
} else if (Array.isArray(remoteDest)) {
url = baseUrl + '#' + JSON.stringify(remoteDest);
}
}
@ -778,7 +778,7 @@ var Catalog = (function CatalogClosure() {
if (isName(dest)) {
dest = dest.name;
}
if (isString(dest) || isArray(dest)) {
if (isString(dest) || Array.isArray(dest)) {
resultObj.dest = dest;
}
}
@ -1501,7 +1501,7 @@ var NameOrNumberTree = (function NameOrNumberTreeClosure() {
continue;
}
var entries = obj.get(this._type);
if (isArray(entries)) {
if (Array.isArray(entries)) {
for (i = 0, n = entries.length; i < n; i += 2) {
dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]);
}
@ -1530,7 +1530,7 @@ var NameOrNumberTree = (function NameOrNumberTreeClosure() {
}
var kids = kidsOrEntries.get('Kids');
if (!isArray(kids)) {
if (!Array.isArray(kids)) {
return null;
}
@ -1558,7 +1558,7 @@ var NameOrNumberTree = (function NameOrNumberTreeClosure() {
// If we get here, then we have found the right entry. Now go through the
// entries in the dictionary until we find the key we're looking for.
var entries = kidsOrEntries.get(this._type);
if (isArray(entries)) {
if (Array.isArray(entries)) {
// Perform a binary search to reduce the lookup time.
l = 0;
r = entries.length - 2;
@ -1709,7 +1709,8 @@ var FileSpec = (function FileSpecClosure() {
*/
let ObjectLoader = (function() {
function mayHaveChildren(value) {
return isRef(value) || isDict(value) || isArray(value) || isStream(value);
return isRef(value) || isDict(value) || Array.isArray(value) ||
isStream(value);
}
function addChildren(node, nodesToVisit) {
@ -1722,7 +1723,7 @@ let ObjectLoader = (function() {
nodesToVisit.push(rawValue);
}
}
} else if (isArray(node)) {
} else if (Array.isArray(node)) {
for (let i = 0, ii = node.length; i < ii; i++) {
let value = node[i];
if (mayHaveChildren(value)) {

View File

@ -18,8 +18,8 @@ import {
JpegStream, JpxStream, LZWStream, NullStream, PredictorStream, RunLengthStream
} from './stream';
import {
assert, FormatError, info, isArray, isNum, isString, MissingDataException,
StreamType, warn
assert, FormatError, info, isNum, isString, MissingDataException, StreamType,
warn
} from '../shared/util';
import {
Cmd, Dict, EOF, isCmd, isDict, isEOF, isName, Name, Ref
@ -384,7 +384,7 @@ var Parser = (function ParserClosure() {
var filter = dict.get('Filter', 'F'), filterName;
if (isName(filter)) {
filterName = filter.name;
} else if (isArray(filter)) {
} else if (Array.isArray(filter)) {
var filterZero = this.xref.fetchIfRef(filter[0]);
if (isName(filterZero)) {
filterName = filterZero.name;
@ -527,14 +527,14 @@ var Parser = (function ParserClosure() {
var filter = dict.get('Filter', 'F');
var params = dict.get('DecodeParms', 'DP');
if (isName(filter)) {
if (isArray(params)) {
if (Array.isArray(params)) {
params = this.xref.fetchIfRef(params[0]);
}
return this.makeFilter(stream, filter.name, length, params);
}
var maybeLength = length;
if (isArray(filter)) {
if (Array.isArray(filter)) {
var filterArray = filter;
var paramsArray = params;
for (var i = 0, ii = filterArray.length; i < ii; ++i) {
@ -544,7 +544,7 @@ var Parser = (function ParserClosure() {
}
params = null;
if (isArray(paramsArray) && (i in paramsArray)) {
if (Array.isArray(paramsArray) && (i in paramsArray)) {
params = this.xref.fetchIfRef(paramsArray[i]);
}
stream = this.makeFilter(stream, filter.name, maybeLength, params);
@ -1077,7 +1077,7 @@ var Linearization = {
}
function getHints() {
var hints = linDict.get('H'), hintsLength, item;
if (isArray(hints) &&
if (Array.isArray(hints) &&
((hintsLength = hints.length) === 2 || hintsLength === 4)) {
for (var index = 0; index < hintsLength; index++) {
if (!(Number.isInteger(item = hints[index]) && item > 0)) {

View File

@ -14,8 +14,6 @@
*/
/* uses XRef */
import { isArray } from '../shared/util';
var EOF = {};
var Name = (function NameClosure() {
@ -117,7 +115,7 @@ var Dict = (function DictClosure() {
getArray: function Dict_getArray(key1, key2, key3) {
var value = this.get(key1, key2, key3);
var xref = this.xref, suppressEncryption = this.suppressEncryption;
if (!isArray(value) || !xref) {
if (!Array.isArray(value) || !xref) {
return value;
}
value = value.slice(); // Ensure that we don't modify the Dict data.

View File

@ -14,7 +14,7 @@
*/
import {
createObjectURL, FormatError, info, isArray, isSpace, shadow, Util
createObjectURL, FormatError, info, isSpace, shadow, Util
} from '../shared/util';
import { Dict, isDict, isStream } from './primitives';
import { Jbig2Image } from './jbig2';
@ -907,7 +907,7 @@ var JpegStream = (function JpegStreamClosure() {
// Checking if values need to be transformed before conversion.
var decodeArr = this.dict.getArray('Decode', 'D');
if (this.forceRGB && isArray(decodeArr)) {
if (this.forceRGB && Array.isArray(decodeArr)) {
var bitsPerComponent = this.dict.get('BitsPerComponent') || 8;
var decodeArrLength = decodeArr.length;
var transform = new Int32Array(decodeArrLength);

View File

@ -14,8 +14,8 @@
*/
import {
FONT_IDENTITY_MATRIX, IDENTITY_MATRIX, ImageKind, info, isArray,
isLittleEndian, isNum, OPS, shadow, TextRenderingMode, Util, warn
FONT_IDENTITY_MATRIX, IDENTITY_MATRIX, ImageKind, info, isLittleEndian, isNum,
OPS, shadow, TextRenderingMode, Util, warn
} from '../shared/util';
import { getShadingPatternFromIR, TilingPattern } from './pattern_helper';
import { WebGLUtils } from './webgl';
@ -1727,13 +1727,13 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
this.save();
this.baseTransformStack.push(this.baseTransform);
if (isArray(matrix) && matrix.length === 6) {
if (Array.isArray(matrix) && matrix.length === 6) {
this.transform.apply(this, matrix);
}
this.baseTransform = this.ctx.mozCurrentTransform;
if (isArray(bbox) && bbox.length === 4) {
if (Array.isArray(bbox) && bbox.length === 4) {
var width = bbox[2] - bbox[0];
var height = bbox[3] - bbox[1];
this.ctx.rect(bbox[0], bbox[1], width, height);
@ -1896,7 +1896,7 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
resetCtxToDefault(this.ctx);
this.current = new CanvasExtraState();
if (isArray(rect) && rect.length === 4) {
if (Array.isArray(rect) && rect.length === 4) {
var width = rect[2] - rect[0];
var height = rect[3] - rect[1];
this.ctx.rect(rect[0], rect[1], width, height);

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { FormatError, info, isArray, Util } from '../shared/util';
import { FormatError, info, Util } from '../shared/util';
import { WebGLUtils } from './webgl';
var ShadingIRs = {};
@ -391,7 +391,7 @@ var TilingPattern = (function TilingPatternClosure() {
},
clipBbox: function clipBbox(graphics, bbox, x0, y0, x1, y1) {
if (isArray(bbox) && bbox.length === 4) {
if (Array.isArray(bbox) && bbox.length === 4) {
var bboxWidth = x1 - x0;
var bboxHeight = y1 - y0;
graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight);

View File

@ -15,8 +15,8 @@
/* globals __non_webpack_require__ */
import {
createObjectURL, FONT_IDENTITY_MATRIX, IDENTITY_MATRIX, ImageKind, isArray,
isNodeJS, isNum, OPS, Util, warn
createObjectURL, FONT_IDENTITY_MATRIX, IDENTITY_MATRIX, ImageKind, isNodeJS,
isNum, OPS, Util, warn
} from '../shared/util';
var SVGGraphics = function() {
@ -1199,12 +1199,12 @@ SVGGraphics = (function SVGGraphicsClosure() {
paintFormXObjectBegin:
function SVGGraphics_paintFormXObjectBegin(matrix, bbox) {
if (isArray(matrix) && matrix.length === 6) {
if (Array.isArray(matrix) && matrix.length === 6) {
this.transform(matrix[0], matrix[1], matrix[2],
matrix[3], matrix[4], matrix[5]);
}
if (isArray(bbox) && bbox.length === 4) {
if (Array.isArray(bbox) && bbox.length === 4) {
var width = bbox[2] - bbox[0];
var height = bbox[3] - bbox[1];

View File

@ -1083,10 +1083,6 @@ function isString(v) {
return typeof v === 'string';
}
function isArray(v) {
return v instanceof Array;
}
function isArrayBuffer(v) {
return typeof v === 'object' && v !== null && v.byteLength !== undefined;
}
@ -1695,7 +1691,6 @@ export {
getLookupTableFactory,
getVerbosityLevel,
info,
isArray,
isArrayBuffer,
isBool,
isEmptyObj,

View File

@ -17,7 +17,6 @@ import {
PostScriptCompiler, PostScriptEvaluator
} from '../../src/core/function';
import { PostScriptLexer, PostScriptParser } from '../../src/core/ps_parser';
import { isArray } from '../../src/shared/util';
import { StringStream } from '../../src/core/stream';
describe('function', function() {
@ -36,7 +35,7 @@ describe('function', function() {
result.pass = true;
for (var i = 0; i < expected.length; i++) {
var a = actual[i], b = expected[i];
if (isArray(b)) {
if (Array.isArray(b)) {
if (a.length !== b.length) {
result.pass = false;
break;