source: imaps-frontend/node_modules/core-js/internals/object-assign.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

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