Replace Util.extendObj by Object.assign

This commit is contained in:
Tim van der Meij 2018-06-10 19:59:03 +02:00
parent 0e0fa489dd
commit af8e88d00b
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762
5 changed files with 14 additions and 14 deletions

View File

@ -13,9 +13,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { import { ImageKind, OPS } from '../shared/util';
ImageKind, OPS, Util
} from '../shared/util';
var QueueOptimizer = (function QueueOptimizerClosure() { var QueueOptimizer = (function QueueOptimizerClosure() {
function addState(parentState, pattern, checkFn, iterateFn, processFn) { function addState(parentState, pattern, checkFn, iterateFn, processFn) {
@ -612,7 +610,7 @@ var OperatorList = (function OperatorListClosure() {
}, },
addOpList(opList) { addOpList(opList) {
Util.extendObj(this.dependencies, opList.dependencies); Object.assign(this.dependencies, opList.dependencies);
for (var i = 0, ii = opList.length; i < ii; i++) { for (var i = 0, ii = opList.length; i < ii; i++) {
this.addOp(opList.fnArray[i], opList.argsArray[i]); this.addOp(opList.fnArray[i], opList.argsArray[i]);
} }

View File

@ -18,7 +18,7 @@ import {
assert, createPromiseCapability, getVerbosityLevel, info, InvalidPDFException, assert, createPromiseCapability, getVerbosityLevel, info, InvalidPDFException,
isArrayBuffer, isSameOrigin, MissingPDFException, NativeImageDecoding, isArrayBuffer, isSameOrigin, MissingPDFException, NativeImageDecoding,
PasswordException, setVerbosityLevel, shadow, stringToBytes, PasswordException, setVerbosityLevel, shadow, stringToBytes,
UnexpectedResponseException, UnknownErrorException, unreachable, Util, warn UnexpectedResponseException, UnknownErrorException, unreachable, warn
} from '../shared/util'; } from '../shared/util';
import { import {
DOMCanvasFactory, DOMCMapReaderFactory, DummyStatTimer, loadScript, DOMCanvasFactory, DOMCMapReaderFactory, DummyStatTimer, loadScript,
@ -1074,7 +1074,7 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
resolve(textContent); resolve(textContent);
return; return;
} }
Util.extendObj(textContent.styles, value.styles); Object.assign(textContent.styles, value.styles);
textContent.items.push(...value.items); textContent.items.push(...value.items);
pump(); pump();
}, reject); }, reject);

View File

@ -578,10 +578,9 @@ var renderTextLayer = (function renderTextLayerClosure() {
return; return;
} }
Util.extendObj(styleCache, value.styles); Object.assign(styleCache, value.styles);
this._processItems(value.items, styleCache); this._processItems(value.items, styleCache);
pump(); pump();
}, capability.reject); }, capability.reject);
}; };

View File

@ -109,6 +109,15 @@ const hasDOM = typeof window === 'object' && typeof document === 'object';
require('core-js/fn/array/includes'); require('core-js/fn/array/includes');
})(); })();
// Provides support for Object.assign in legacy browsers.
// Support: IE
(function checkObjectAssign() {
if (Object.assign) {
return;
}
require('core-js/fn/object/assign');
})();
// Provides support for Math.log2 in legacy browsers. // Provides support for Math.log2 in legacy browsers.
// Support: IE, Chrome<38 // Support: IE, Chrome<38
(function checkMathLog2() { (function checkMathLog2() {

View File

@ -886,12 +886,6 @@ var Util = (function UtilClosure() {
return (lowerCase ? romanStr.toLowerCase() : romanStr); return (lowerCase ? romanStr.toLowerCase() : romanStr);
}; };
Util.extendObj = function extendObj(obj1, obj2) {
for (var key in obj2) {
obj1[key] = obj2[key];
}
};
Util.inherit = function Util_inherit(sub, base, prototype) { Util.inherit = function Util_inherit(sub, base, prototype) {
sub.prototype = Object.create(base.prototype); sub.prototype = Object.create(base.prototype);
sub.prototype.constructor = sub; sub.prototype.constructor = sub;