source: trip-planner-front/node_modules/core-js/internals/object-assign.js@ e29cc2e

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

initial commit

  • Property mode set to 100644
File size: 2.2 KB
Line 
1'use strict';
2var DESCRIPTORS = require('../internals/descriptors');
3var fails = require('../internals/fails');
4var objectKeys = require('../internals/object-keys');
5var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
6var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
7var toObject = require('../internals/to-object');
8var IndexedObject = require('../internals/indexed-object');
9
10// eslint-disable-next-line es/no-object-assign -- safe
11var $assign = Object.assign;
12// eslint-disable-next-line es/no-object-defineproperty -- required for testing
13var defineProperty = Object.defineProperty;
14
15// `Object.assign` method
16// https://tc39.es/ecma262/#sec-object.assign
17module.exports = !$assign || fails(function () {
18 // should have correct order of operations (Edge bug)
19 if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
20 enumerable: true,
21 get: function () {
22 defineProperty(this, 'b', {
23 value: 3,
24 enumerable: false
25 });
26 }
27 }), { b: 2 })).b !== 1) return true;
28 // should work with symbols and should have deterministic property order (V8 bug)
29 var A = {};
30 var B = {};
31 // eslint-disable-next-line es/no-symbol -- safe
32 var symbol = Symbol();
33 var alphabet = 'abcdefghijklmnopqrst';
34 A[symbol] = 7;
35 alphabet.split('').forEach(function (chr) { B[chr] = chr; });
36 return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
37}) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
38 var T = toObject(target);
39 var argumentsLength = arguments.length;
40 var index = 1;
41 var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
42 var propertyIsEnumerable = propertyIsEnumerableModule.f;
43 while (argumentsLength > index) {
44 var S = IndexedObject(arguments[index++]);
45 var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
46 var length = keys.length;
47 var j = 0;
48 var key;
49 while (length > j) {
50 key = keys[j++];
51 if (!DESCRIPTORS || propertyIsEnumerable.call(S, key)) T[key] = S[key];
52 }
53 } return T;
54} : $assign;
Note: See TracBrowser for help on using the repository browser.