Sha256: 4b4409dbd8df61213ef89c0c3f46891269d61345e11f7d998ec1ba2bea0e52bb

Contents?: true

Size: 1.38 KB

Versions: 41

Compression:

Stored size: 1.38 KB

Contents

'use strict';

// modified from https://github.com/es-shims/es6-shim
var objectKeys = require('object-keys');
var hasSymbols = require('has-symbols/shams')();
var callBound = require('call-bind/callBound');
var toObject = Object;
var $push = callBound('Array.prototype.push');
var $propIsEnumerable = callBound('Object.prototype.propertyIsEnumerable');
var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;

// eslint-disable-next-line no-unused-vars
module.exports = function assign(target, source1) {
	if (target == null) { throw new TypeError('target must be an object'); }
	var to = toObject(target); // step 1
	if (arguments.length === 1) {
		return to; // step 2
	}
	for (var s = 1; s < arguments.length; ++s) {
		var from = toObject(arguments[s]); // step 3.a.i

		// step 3.a.ii:
		var keys = objectKeys(from);
		var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
		if (getSymbols) {
			var syms = getSymbols(from);
			for (var j = 0; j < syms.length; ++j) {
				var key = syms[j];
				if ($propIsEnumerable(from, key)) {
					$push(keys, key);
				}
			}
		}

		// step 3.a.iii:
		for (var i = 0; i < keys.length; ++i) {
			var nextKey = keys[i];
			if ($propIsEnumerable(from, nextKey)) { // step 3.a.iii.2
				var propValue = from[nextKey]; // step 3.a.iii.2.a
				to[nextKey] = propValue; // step 3.a.iii.2.b
			}
		}
	}

	return to; // step 4
};

Version data entries

41 entries across 41 versions & 2 rubygems

Version Path
immosquare-cleaner-0.1.51 node_modules/object.assign/implementation.js
immosquare-cleaner-0.1.50 node_modules/object.assign/implementation.js
immosquare-cleaner-0.1.49 node_modules/object.assign/implementation.js
immosquare-cleaner-0.1.48 node_modules/object.assign/implementation.js
immosquare-cleaner-0.1.47 node_modules/object.assign/implementation.js
immosquare-cleaner-0.1.46 node_modules/object.assign/implementation.js
immosquare-cleaner-0.1.45 node_modules/object.assign/implementation.js
immosquare-cleaner-0.1.44 node_modules/object.assign/implementation.js
immosquare-cleaner-0.1.43 node_modules/object.assign/implementation.js
immosquare-cleaner-0.1.42 node_modules/object.assign/implementation.js
immosquare-cleaner-0.1.41 node_modules/object.assign/implementation.js
immosquare-cleaner-0.1.40 node_modules/object.assign/implementation.js
immosquare-cleaner-0.1.39 node_modules/object.assign/implementation.js
immosquare-cleaner-0.1.38 node_modules/object.assign/implementation.js
immosquare-cleaner-0.1.32 node_modules/object.assign/implementation.js
immosquare-cleaner-0.1.31 node_modules/object.assign/implementation.js
immosquare-cleaner-0.1.30 node_modules/object.assign/implementation.js
immosquare-cleaner-0.1.29 node_modules/object.assign/implementation.js
immosquare-cleaner-0.1.28 node_modules/object.assign/implementation.js
immosquare-cleaner-0.1.27 node_modules/object.assign/implementation.js