source: trip-planner-front/node_modules/object.assign/implementation.js@ eed0bf8

Last change on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.3 KB
Line 
1'use strict';
2
3// modified from https://github.com/es-shims/es6-shim
4var keys = require('object-keys');
5var canBeObject = function (obj) {
6 return typeof obj !== 'undefined' && obj !== null;
7};
8var hasSymbols = require('has-symbols/shams')();
9var callBound = require('call-bind/callBound');
10var toObject = Object;
11var $push = callBound('Array.prototype.push');
12var $propIsEnumerable = callBound('Object.prototype.propertyIsEnumerable');
13var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;
14
15// eslint-disable-next-line no-unused-vars
16module.exports = function assign(target, source1) {
17 if (!canBeObject(target)) { throw new TypeError('target must be an object'); }
18 var objTarget = toObject(target);
19 var s, source, i, props, syms, value, key;
20 for (s = 1; s < arguments.length; ++s) {
21 source = toObject(arguments[s]);
22 props = keys(source);
23 var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
24 if (getSymbols) {
25 syms = getSymbols(source);
26 for (i = 0; i < syms.length; ++i) {
27 key = syms[i];
28 if ($propIsEnumerable(source, key)) {
29 $push(props, key);
30 }
31 }
32 }
33 for (i = 0; i < props.length; ++i) {
34 key = props[i];
35 value = source[key];
36 if ($propIsEnumerable(source, key)) {
37 objTarget[key] = value;
38 }
39 }
40 }
41 return objTarget;
42};
Note: See TracBrowser for help on using the repository browser.