From 09df112d321c10614efeb4456633f9ce3a4ebfaa Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Sat, 9 Jun 2018 20:51:15 +0200 Subject: [PATCH] Remove `Util.appendToArray` and `Util.prependToArray` The former may be replaced by regular JavaScript array concatenation and the latter is unused. This avoids unnecessary function calls/imports. --- src/core/stream.js | 4 ++-- src/display/api.js | 2 +- src/shared/util.js | 8 -------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/core/stream.js b/src/core/stream.js index 4bc5eb57ecee00..6840306397f086 100644 --- a/src/core/stream.js +++ b/src/core/stream.js @@ -13,7 +13,7 @@ * limitations under the License. */ -import { FormatError, isSpace, stringToBytes, Util } from '../shared/util'; +import { FormatError, isSpace, stringToBytes } from '../shared/util'; import { isDict } from './primitives'; var Stream = (function StreamClosure() { @@ -274,7 +274,7 @@ var StreamsSequenceStream = (function StreamsSequenceStreamClosure() { for (var i = 0, ii = this.streams.length; i < ii; i++) { var stream = this.streams[i]; if (stream.getBaseStreams) { - Util.appendToArray(baseStreams, stream.getBaseStreams()); + baseStreams = baseStreams.concat(stream.getBaseStreams()); } } return baseStreams; diff --git a/src/display/api.js b/src/display/api.js index c9c8d41641342b..80241b6e809a60 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -1075,7 +1075,7 @@ var PDFPageProxy = (function PDFPageProxyClosure() { return; } Util.extendObj(textContent.styles, value.styles); - Util.appendToArray(textContent.items, value.items); + textContent.items = textContent.items.concat(value.items); pump(); }, reject); } diff --git a/src/shared/util.js b/src/shared/util.js index a52df0c427930f..cd650d902105ef 100644 --- a/src/shared/util.js +++ b/src/shared/util.js @@ -886,14 +886,6 @@ var Util = (function UtilClosure() { return (lowerCase ? romanStr.toLowerCase() : romanStr); }; - Util.appendToArray = function Util_appendToArray(arr1, arr2) { - Array.prototype.push.apply(arr1, arr2); - }; - - Util.prependToArray = function Util_prependToArray(arr1, arr2) { - Array.prototype.unshift.apply(arr1, arr2); - }; - Util.extendObj = function extendObj(obj1, obj2) { for (var key in obj2) { obj1[key] = obj2[key];