From 4510e7e61db27b264c1fadc125beb2d4c80f07df Mon Sep 17 00:00:00 2001 From: Johann-S Date: Mon, 11 Jun 2018 22:25:37 +0200 Subject: fix(util): remove extend --- js/src/dom/polyfill.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'js/src/dom/polyfill.js') diff --git a/js/src/dom/polyfill.js b/js/src/dom/polyfill.js index 159884df8..c0c1139f0 100644 --- a/js/src/dom/polyfill.js +++ b/js/src/dom/polyfill.js @@ -155,6 +155,33 @@ const Polyfill = (() => { } } + if (typeof Object.assign !== 'function') { + Object.defineProperty(Object, 'assign', { + value: (target, ...args) => { + if (target === null || typeof target === 'undefined') { + throw new TypeError('Cannot convert undefined or null to object') + } + + const to = Object(target) + + for (let index = 1; index < args.length; index++) { + const nextSource = args[index] + + if (nextSource !== null || !nextSource) { + for (const nextKey in nextSource) { + if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { + to[nextKey] = nextSource[nextKey] + } + } + } + } + return to + }, + writable: true, + configurable: true + }) + } + return { defaultPreventedPreservedOnDispatch, focusIn: typeof window.onfocusin === 'undefined', -- cgit v1.2.3