Skip to content

Commit

Permalink
Remove Util.appendToArray and Util.prependToArray
Browse files Browse the repository at this point in the history
The former may be replaced by regular JavaScript array concatenation and
the latter is unused. This avoids unnecessary function calls/imports.
  • Loading branch information
timvandermeij committed Jun 9, 2018
1 parent db874b6 commit 09df112
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/core/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/display/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 0 additions & 8 deletions src/shared/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 09df112

Please sign in to comment.