Object.assign shim

An Object.assign shim.

Ten skrypt nie powinien być instalowany bezpośrednio. Jest to biblioteka dla innych skyptów do włączenia dyrektywą meta // @require https://update.greasyfork.org/scripts/2666/7344/Objectassign%20shim.js

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        Object.assign shim
// @description An Object.assign shim.
// @version     0.13.0
// @license     MIT License;
// ==/UserScript==
// modified from https://github.com/es-shims/es6-shim
(function(){
	'use strict';
	
	var isObject = function (obj) {
		return obj && typeof obj === 'object';
	};

	if(Object.assign) return;
	Object.defineProperty(Object, 'assign', {
		value: function(target, source){
			var s, i, props;
			if (!isObject(target)) { throw new TypeError('target must be an object'); }
			for (s = 1; s < arguments.length; ++s) {
				source = arguments[s];
				if (!isObject(source)) { throw new TypeError('source ' + s + ' must be an object'); }
				props = Object.keys(Object(source));
				for (i = 0; i < props.length; ++i) {
					target[props[i]] = source[props[i]];
				}
			}
			return target;
		},
		enumerable: false
	});
})();