core-js 3.2.0 → 3.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/configurator.js +7 -0
  2. package/es/global-this.js +3 -0
  3. package/es/index.js +1 -0
  4. package/features/async-iterator/as-indexed-pairs.js +10 -0
  5. package/features/async-iterator/drop.js +10 -0
  6. package/features/async-iterator/every.js +10 -0
  7. package/features/async-iterator/filter.js +10 -0
  8. package/features/async-iterator/find.js +10 -0
  9. package/features/async-iterator/flat-map.js +10 -0
  10. package/features/async-iterator/for-each.js +10 -0
  11. package/features/async-iterator/from.js +10 -0
  12. package/features/async-iterator/index.js +22 -0
  13. package/features/async-iterator/map.js +10 -0
  14. package/features/async-iterator/reduce.js +10 -0
  15. package/features/async-iterator/some.js +10 -0
  16. package/features/async-iterator/take.js +10 -0
  17. package/features/async-iterator/to-array.js +10 -0
  18. package/features/global-this.js +1 -3
  19. package/features/iterator/as-indexed-pairs.js +10 -0
  20. package/features/iterator/drop.js +9 -0
  21. package/features/iterator/every.js +9 -0
  22. package/features/iterator/filter.js +9 -0
  23. package/features/iterator/find.js +9 -0
  24. package/features/iterator/flat-map.js +9 -0
  25. package/features/iterator/for-each.js +9 -0
  26. package/features/iterator/from.js +9 -0
  27. package/features/iterator/index.js +21 -0
  28. package/features/iterator/map.js +9 -0
  29. package/features/iterator/reduce.js +9 -0
  30. package/features/iterator/some.js +9 -0
  31. package/features/iterator/take.js +9 -0
  32. package/features/iterator/to-array.js +9 -0
  33. package/features/map/index.js +2 -0
  34. package/features/map/update-or-insert.js +1 -0
  35. package/features/map/upsert.js +5 -0
  36. package/features/weak-map/index.js +1 -0
  37. package/features/weak-map/upsert.js +5 -0
  38. package/internals/add-to-unscopables.js +2 -2
  39. package/internals/array-buffer-view-core.js +2 -2
  40. package/internals/array-buffer.js +9 -4
  41. package/internals/array-from.js +3 -2
  42. package/internals/async-iterator-iteration.js +61 -0
  43. package/internals/async-iterator-prototype.js +37 -0
  44. package/internals/create-async-iterator-proxy.js +61 -0
  45. package/internals/create-iterator-proxy.js +51 -0
  46. package/internals/{hide.js → create-non-enumerable-property.js} +0 -0
  47. package/internals/define-iterator.js +3 -3
  48. package/internals/export.js +2 -2
  49. package/internals/fix-regexp-well-known-symbol-logic.js +2 -2
  50. package/internals/get-async-iterator-method.js +9 -0
  51. package/internals/global.js +4 -5
  52. package/internals/internal-state.js +2 -2
  53. package/internals/iterate.js +4 -3
  54. package/internals/iterators-core.js +4 -2
  55. package/internals/map-upsert.js +23 -0
  56. package/internals/microtask.js +4 -3
  57. package/internals/native-url.js +13 -4
  58. package/internals/redefine.js +3 -3
  59. package/internals/set-global.js +2 -2
  60. package/internals/shared-store.js +7 -0
  61. package/internals/shared.js +2 -6
  62. package/internals/task.js +3 -1
  63. package/internals/to-offset.js +3 -3
  64. package/internals/to-positive-integer.js +7 -0
  65. package/internals/typed-array-constructor.js +10 -7
  66. package/internals/typed-array-from.js +3 -2
  67. package/modules/es.date.to-primitive.js +4 -2
  68. package/modules/es.global-this.js +8 -0
  69. package/modules/es.promise.js +2 -1
  70. package/modules/es.string.match-all.js +22 -7
  71. package/modules/es.symbol.js +4 -2
  72. package/modules/esnext.aggregate-error.js +28 -4
  73. package/modules/esnext.async-iterator.as-indexed-pairs.js +27 -0
  74. package/modules/esnext.async-iterator.constructor.js +25 -0
  75. package/modules/esnext.async-iterator.drop.js +41 -0
  76. package/modules/esnext.async-iterator.every.js +10 -0
  77. package/modules/esnext.async-iterator.filter.js +42 -0
  78. package/modules/esnext.async-iterator.find.js +10 -0
  79. package/modules/esnext.async-iterator.flat-map.js +67 -0
  80. package/modules/esnext.async-iterator.for-each.js +10 -0
  81. package/modules/esnext.async-iterator.from.js +30 -0
  82. package/modules/esnext.async-iterator.map.js +30 -0
  83. package/modules/esnext.async-iterator.reduce.js +46 -0
  84. package/modules/esnext.async-iterator.some.js +10 -0
  85. package/modules/esnext.async-iterator.take.js +22 -0
  86. package/modules/esnext.async-iterator.to-array.js +10 -0
  87. package/modules/esnext.global-this.js +2 -8
  88. package/modules/esnext.iterator.as-indexed-pairs.js +20 -0
  89. package/modules/esnext.iterator.constructor.js +39 -0
  90. package/modules/esnext.iterator.drop.js +30 -0
  91. package/modules/esnext.iterator.every.js +16 -0
  92. package/modules/esnext.iterator.filter.js +30 -0
  93. package/modules/esnext.iterator.find.js +16 -0
  94. package/modules/esnext.iterator.flat-map.js +45 -0
  95. package/modules/esnext.iterator.for-each.js +11 -0
  96. package/modules/esnext.iterator.from.js +32 -0
  97. package/modules/esnext.iterator.map.js +23 -0
  98. package/modules/esnext.iterator.reduce.js +25 -0
  99. package/modules/esnext.iterator.some.js +16 -0
  100. package/modules/esnext.iterator.take.js +25 -0
  101. package/modules/esnext.iterator.to-array.js +15 -0
  102. package/modules/esnext.map.reduce.js +9 -8
  103. package/modules/esnext.map.update-or-insert.js +5 -12
  104. package/modules/esnext.map.upsert.js +10 -0
  105. package/modules/esnext.math.signbit.js +0 -1
  106. package/modules/esnext.observable.js +2 -2
  107. package/modules/esnext.set.reduce.js +9 -8
  108. package/modules/esnext.string.match-all.js +0 -1
  109. package/modules/esnext.string.replace-all.js +13 -19
  110. package/modules/esnext.symbol.replace-all.js +1 -2
  111. package/modules/esnext.weak-map.upsert.js +10 -0
  112. package/modules/web.dom-collections.for-each.js +2 -2
  113. package/modules/web.dom-collections.iterator.js +6 -4
  114. package/modules/web.url-search-params.js +7 -5
  115. package/package.json +2 -2
  116. package/postinstall.js +49 -0
  117. package/proposals/iterator-helpers.js +20 -0
  118. package/proposals/map-update-or-insert.js +2 -1
  119. package/proposals/map-upsert.js +5 -0
  120. package/stable/global-this.js +1 -3
  121. package/stage/1.js +0 -1
  122. package/stage/2.js +2 -2
  123. package/stage/3.js +2 -1
  124. package/stage/4.js +1 -0
  125. package/scripts/postinstall.js +0 -24
@@ -0,0 +1,61 @@
1
+ 'use strict';
2
+ var path = require('../internals/path');
3
+ var aFunction = require('../internals/a-function');
4
+ var anObject = require('../internals/an-object');
5
+ var create = require('../internals/object-create');
6
+ var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
7
+ var redefineAll = require('../internals/redefine-all');
8
+ var wellKnownSymbol = require('../internals/well-known-symbol');
9
+ var InternalStateModule = require('../internals/internal-state');
10
+ var getBuiltIn = require('../internals/get-built-in');
11
+
12
+ var Promise = getBuiltIn('Promise');
13
+
14
+ var setInternalState = InternalStateModule.set;
15
+ var getInternalState = InternalStateModule.get;
16
+
17
+ var TO_STRING_TAG = wellKnownSymbol('toStringTag');
18
+
19
+ var $return = function (value) {
20
+ var iterator = getInternalState(this).iterator;
21
+ var $$return = iterator['return'];
22
+ return $$return === undefined
23
+ ? Promise.resolve({ done: true, value: value })
24
+ : anObject($$return.call(iterator, value));
25
+ };
26
+
27
+ var $throw = function (value) {
28
+ var iterator = getInternalState(this).iterator;
29
+ var $$throw = iterator['throw'];
30
+ return $$throw === undefined
31
+ ? Promise.reject(value)
32
+ : $$throw.call(iterator, value);
33
+ };
34
+
35
+ module.exports = function (nextHandler, IS_ITERATOR) {
36
+ var AsyncIteratorProxy = function AsyncIterator(state) {
37
+ state.next = aFunction(state.iterator.next);
38
+ state.done = false;
39
+ setInternalState(this, state);
40
+ };
41
+
42
+ AsyncIteratorProxy.prototype = redefineAll(create(path.AsyncIterator.prototype), {
43
+ next: function next(arg) {
44
+ var state = getInternalState(this);
45
+ if (state.done) return Promise.resolve({ done: true, value: undefined });
46
+ try {
47
+ return Promise.resolve(anObject(nextHandler.call(state, arg, Promise)));
48
+ } catch (error) {
49
+ return Promise.reject(error);
50
+ }
51
+ },
52
+ 'return': $return,
53
+ 'throw': $throw
54
+ });
55
+
56
+ if (!IS_ITERATOR) {
57
+ createNonEnumerableProperty(AsyncIteratorProxy.prototype, TO_STRING_TAG, 'Generator');
58
+ }
59
+
60
+ return AsyncIteratorProxy;
61
+ };
@@ -0,0 +1,51 @@
1
+ 'use strict';
2
+ var path = require('../internals/path');
3
+ var aFunction = require('../internals/a-function');
4
+ var anObject = require('../internals/an-object');
5
+ var create = require('../internals/object-create');
6
+ var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
7
+ var redefineAll = require('../internals/redefine-all');
8
+ var wellKnownSymbol = require('../internals/well-known-symbol');
9
+ var InternalStateModule = require('../internals/internal-state');
10
+
11
+ var setInternalState = InternalStateModule.set;
12
+ var getInternalState = InternalStateModule.get;
13
+
14
+ var TO_STRING_TAG = wellKnownSymbol('toStringTag');
15
+
16
+ var $return = function (value) {
17
+ var iterator = getInternalState(this).iterator;
18
+ var $$return = iterator['return'];
19
+ return $$return === undefined ? { done: true, value: value } : anObject($$return.call(iterator, value));
20
+ };
21
+
22
+ var $throw = function (value) {
23
+ var iterator = getInternalState(this).iterator;
24
+ var $$throw = iterator['throw'];
25
+ if ($$throw === undefined) throw value;
26
+ return $$throw.call(iterator, value);
27
+ };
28
+
29
+ module.exports = function (nextHandler, IS_ITERATOR) {
30
+ var IteratorProxy = function Iterator(state) {
31
+ state.next = aFunction(state.iterator.next);
32
+ state.done = false;
33
+ setInternalState(this, state);
34
+ };
35
+
36
+ IteratorProxy.prototype = redefineAll(create(path.Iterator.prototype), {
37
+ next: function next() {
38
+ var state = getInternalState(this);
39
+ var result = state.done ? undefined : nextHandler.apply(state, arguments);
40
+ return { done: state.done, value: result };
41
+ },
42
+ 'return': $return,
43
+ 'throw': $throw
44
+ });
45
+
46
+ if (!IS_ITERATOR) {
47
+ createNonEnumerableProperty(IteratorProxy.prototype, TO_STRING_TAG, 'Generator');
48
+ }
49
+
50
+ return IteratorProxy;
51
+ };
@@ -4,7 +4,7 @@ var createIteratorConstructor = require('../internals/create-iterator-constructo
4
4
  var getPrototypeOf = require('../internals/object-get-prototype-of');
5
5
  var setPrototypeOf = require('../internals/object-set-prototype-of');
6
6
  var setToStringTag = require('../internals/set-to-string-tag');
7
- var hide = require('../internals/hide');
7
+ var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
8
8
  var redefine = require('../internals/redefine');
9
9
  var wellKnownSymbol = require('../internals/well-known-symbol');
10
10
  var IS_PURE = require('../internals/is-pure');
@@ -51,7 +51,7 @@ module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, I
51
51
  if (setPrototypeOf) {
52
52
  setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
53
53
  } else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') {
54
- hide(CurrentIteratorPrototype, ITERATOR, returnThis);
54
+ createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR, returnThis);
55
55
  }
56
56
  }
57
57
  // Set @@toStringTag to native iterators
@@ -68,7 +68,7 @@ module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, I
68
68
 
69
69
  // define iterator
70
70
  if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
71
- hide(IterablePrototype, ITERATOR, defaultIterator);
71
+ createNonEnumerableProperty(IterablePrototype, ITERATOR, defaultIterator);
72
72
  }
73
73
  Iterators[NAME] = defaultIterator;
74
74
 
@@ -1,6 +1,6 @@
1
1
  var global = require('../internals/global');
2
2
  var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
3
- var hide = require('../internals/hide');
3
+ var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
4
4
  var redefine = require('../internals/redefine');
5
5
  var setGlobal = require('../internals/set-global');
6
6
  var copyConstructorProperties = require('../internals/copy-constructor-properties');
@@ -46,7 +46,7 @@ module.exports = function (options, source) {
46
46
  }
47
47
  // add a flag to not completely full polyfills
48
48
  if (options.sham || (targetProperty && targetProperty.sham)) {
49
- hide(sourceProperty, 'sham', true);
49
+ createNonEnumerableProperty(sourceProperty, 'sham', true);
50
50
  }
51
51
  // extend global
52
52
  redefine(target, key, sourceProperty, options);
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
- var hide = require('../internals/hide');
2
+ var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
3
3
  var redefine = require('../internals/redefine');
4
4
  var fails = require('../internals/fails');
5
5
  var wellKnownSymbol = require('../internals/well-known-symbol');
@@ -88,6 +88,6 @@ module.exports = function (KEY, length, exec, sham) {
88
88
  // 21.2.5.9 RegExp.prototype[@@search](string)
89
89
  : function (string) { return regexMethod.call(string, this); }
90
90
  );
91
- if (sham) hide(RegExp.prototype[SYMBOL], 'sham', true);
91
+ if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
92
92
  }
93
93
  };
@@ -0,0 +1,9 @@
1
+ var getIteratorMethod = require('../internals/get-iterator-method');
2
+ var wellKnownSymbol = require('../internals/well-known-symbol');
3
+
4
+ var ASYNC_ITERATOR = wellKnownSymbol('asyncIterator');
5
+
6
+ module.exports = function (it) {
7
+ var method = it[ASYNC_ITERATOR];
8
+ return method === undefined ? getIteratorMethod(it) : method;
9
+ };
@@ -1,4 +1,3 @@
1
- var O = 'object';
2
1
  var check = function (it) {
3
2
  return it && it.Math == Math && it;
4
3
  };
@@ -6,9 +5,9 @@ var check = function (it) {
6
5
  // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
7
6
  module.exports =
8
7
  // eslint-disable-next-line no-undef
9
- check(typeof globalThis == O && globalThis) ||
10
- check(typeof window == O && window) ||
11
- check(typeof self == O && self) ||
12
- check(typeof global == O && global) ||
8
+ check(typeof globalThis == 'object' && globalThis) ||
9
+ check(typeof window == 'object' && window) ||
10
+ check(typeof self == 'object' && self) ||
11
+ check(typeof global == 'object' && global) ||
13
12
  // eslint-disable-next-line no-new-func
14
13
  Function('return this')();
@@ -1,7 +1,7 @@
1
1
  var NATIVE_WEAK_MAP = require('../internals/native-weak-map');
2
2
  var global = require('../internals/global');
3
3
  var isObject = require('../internals/is-object');
4
- var hide = require('../internals/hide');
4
+ var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
5
5
  var objectHas = require('../internals/has');
6
6
  var sharedKey = require('../internals/shared-key');
7
7
  var hiddenKeys = require('../internals/hidden-keys');
@@ -41,7 +41,7 @@ if (NATIVE_WEAK_MAP) {
41
41
  var STATE = sharedKey('state');
42
42
  hiddenKeys[STATE] = true;
43
43
  set = function (it, metadata) {
44
- hide(it, STATE, metadata);
44
+ createNonEnumerableProperty(it, STATE, metadata);
45
45
  return metadata;
46
46
  };
47
47
  get = function (it) {
@@ -12,7 +12,7 @@ var Result = function (stopped, result) {
12
12
 
13
13
  var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) {
14
14
  var boundFunction = bind(fn, that, AS_ENTRIES ? 2 : 1);
15
- var iterator, iterFn, index, length, result, step;
15
+ var iterator, iterFn, index, length, result, next, step;
16
16
 
17
17
  if (IS_ITERATOR) {
18
18
  iterator = iterable;
@@ -31,9 +31,10 @@ var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITER
31
31
  iterator = iterFn.call(iterable);
32
32
  }
33
33
 
34
- while (!(step = iterator.next()).done) {
34
+ next = iterator.next;
35
+ while (!(step = next.call(iterator)).done) {
35
36
  result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES);
36
- if (result && result instanceof Result) return result;
37
+ if (typeof result == 'object' && result && result instanceof Result) return result;
37
38
  } return new Result(false);
38
39
  };
39
40
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  var getPrototypeOf = require('../internals/object-get-prototype-of');
3
- var hide = require('../internals/hide');
3
+ var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
4
4
  var has = require('../internals/has');
5
5
  var wellKnownSymbol = require('../internals/well-known-symbol');
6
6
  var IS_PURE = require('../internals/is-pure');
@@ -27,7 +27,9 @@ if ([].keys) {
27
27
  if (IteratorPrototype == undefined) IteratorPrototype = {};
28
28
 
29
29
  // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
30
- if (!IS_PURE && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
30
+ if (!IS_PURE && !has(IteratorPrototype, ITERATOR)) {
31
+ createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
32
+ }
31
33
 
32
34
  module.exports = {
33
35
  IteratorPrototype: IteratorPrototype,
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+ var anObject = require('../internals/an-object');
3
+
4
+ // `Map.prototype.upsert` method
5
+ // https://github.com/thumbsupep/proposal-upsert
6
+ module.exports = function upsert(key, updateFn /* , insertFn */) {
7
+ var map = anObject(this);
8
+ var insertFn = arguments.length > 2 ? arguments[2] : undefined;
9
+ var value;
10
+ if (typeof updateFn != 'function' && typeof insertFn != 'function') {
11
+ throw TypeError('At least one callback required');
12
+ }
13
+ if (map.has(key)) {
14
+ value = map.get(key);
15
+ if (typeof updateFn == 'function') {
16
+ value = updateFn(value);
17
+ map.set(key, value);
18
+ }
19
+ } else if (typeof insertFn == 'function') {
20
+ value = insertFn();
21
+ map.set(key, value);
22
+ } return value;
23
+ };
@@ -12,7 +12,7 @@ var IS_NODE = classof(process) == 'process';
12
12
  var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
13
13
  var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
14
14
 
15
- var flush, head, last, notify, toggle, node, promise;
15
+ var flush, head, last, notify, toggle, node, promise, then;
16
16
 
17
17
  // modern engines have queueMicrotask method
18
18
  if (!queueMicrotask) {
@@ -42,7 +42,7 @@ if (!queueMicrotask) {
42
42
  } else if (MutationObserver && !/(iphone|ipod|ipad).*applewebkit/i.test(userAgent)) {
43
43
  toggle = true;
44
44
  node = document.createTextNode('');
45
- new MutationObserver(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
45
+ new MutationObserver(flush).observe(node, { characterData: true });
46
46
  notify = function () {
47
47
  node.data = toggle = !toggle;
48
48
  };
@@ -50,8 +50,9 @@ if (!queueMicrotask) {
50
50
  } else if (Promise && Promise.resolve) {
51
51
  // Promise.resolve without an argument throws an error in LG WebOS 2
52
52
  promise = Promise.resolve(undefined);
53
+ then = promise.then;
53
54
  notify = function () {
54
- promise.then(flush);
55
+ then.call(promise, flush);
55
56
  };
56
57
  // for other environments - macrotask based on:
57
58
  // - setImmediate
@@ -5,13 +5,18 @@ var IS_PURE = require('../internals/is-pure');
5
5
  var ITERATOR = wellKnownSymbol('iterator');
6
6
 
7
7
  module.exports = !fails(function () {
8
- var url = new URL('b?e=1', 'http://a');
8
+ var url = new URL('b?a=1&b=2&c=3', 'http://a');
9
9
  var searchParams = url.searchParams;
10
+ var result = '';
10
11
  url.pathname = 'c%20d';
12
+ searchParams.forEach(function (value, key) {
13
+ searchParams['delete']('b');
14
+ result += key + value;
15
+ });
11
16
  return (IS_PURE && !url.toJSON)
12
17
  || !searchParams.sort
13
- || url.href !== 'http://a/c%20d?e=1'
14
- || searchParams.get('e') !== '1'
18
+ || url.href !== 'http://a/c%20d?a=1&c=3'
19
+ || searchParams.get('c') !== '3'
15
20
  || String(new URLSearchParams('?a=1')) !== 'a=1'
16
21
  || !searchParams[ITERATOR]
17
22
  // throws in Edge
@@ -20,5 +25,9 @@ module.exports = !fails(function () {
20
25
  // not punycoded in Edge
21
26
  || new URL('http://тест').host !== 'xn--e1aybc'
22
27
  // not escaped in Chrome 62-
23
- || new URL('http://a#б').hash !== '#%D0%B1';
28
+ || new URL('http://a#б').hash !== '#%D0%B1'
29
+ // fails in Chrome 66-
30
+ || result !== 'a1c3'
31
+ // throws in Safari
32
+ || new URL('http://x', undefined).host !== 'x';
24
33
  });
@@ -1,6 +1,6 @@
1
1
  var global = require('../internals/global');
2
2
  var shared = require('../internals/shared');
3
- var hide = require('../internals/hide');
3
+ var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
4
4
  var has = require('../internals/has');
5
5
  var setGlobal = require('../internals/set-global');
6
6
  var nativeFunctionToString = require('../internals/function-to-string');
@@ -19,7 +19,7 @@ shared('inspectSource', function (it) {
19
19
  var simple = options ? !!options.enumerable : false;
20
20
  var noTargetGet = options ? !!options.noTargetGet : false;
21
21
  if (typeof value == 'function') {
22
- if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
22
+ if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key);
23
23
  enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
24
24
  }
25
25
  if (O === global) {
@@ -32,7 +32,7 @@ shared('inspectSource', function (it) {
32
32
  simple = true;
33
33
  }
34
34
  if (simple) O[key] = value;
35
- else hide(O, key, value);
35
+ else createNonEnumerableProperty(O, key, value);
36
36
  // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
37
37
  })(Function.prototype, 'toString', function toString() {
38
38
  return typeof this == 'function' && getInternalState(this).source || nativeFunctionToString.call(this);
@@ -1,9 +1,9 @@
1
1
  var global = require('../internals/global');
2
- var hide = require('../internals/hide');
2
+ var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
3
3
 
4
4
  module.exports = function (key, value) {
5
5
  try {
6
- hide(global, key, value);
6
+ createNonEnumerableProperty(global, key, value);
7
7
  } catch (error) {
8
8
  global[key] = value;
9
9
  } return value;
@@ -0,0 +1,7 @@
1
+ var global = require('../internals/global');
2
+ var setGlobal = require('../internals/set-global');
3
+
4
+ var SHARED = '__core-js_shared__';
5
+ var store = global[SHARED] || setGlobal(SHARED, {});
6
+
7
+ module.exports = store;
@@ -1,14 +1,10 @@
1
- var global = require('../internals/global');
2
- var setGlobal = require('../internals/set-global');
3
1
  var IS_PURE = require('../internals/is-pure');
4
-
5
- var SHARED = '__core-js_shared__';
6
- var store = global[SHARED] || setGlobal(SHARED, {});
2
+ var store = require('../internals/shared-store');
7
3
 
8
4
  (module.exports = function (key, value) {
9
5
  return store[key] || (store[key] = value !== undefined ? value : {});
10
6
  })('versions', []).push({
11
- version: '3.2.0',
7
+ version: '3.3.2',
12
8
  mode: IS_PURE ? 'pure' : 'global',
13
9
  copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
14
10
  });
package/internals/task.js CHANGED
@@ -4,6 +4,7 @@ var classof = require('../internals/classof-raw');
4
4
  var bind = require('../internals/bind-context');
5
5
  var html = require('../internals/html');
6
6
  var createElement = require('../internals/document-create-element');
7
+ var userAgent = require('../internals/user-agent');
7
8
 
8
9
  var location = global.location;
9
10
  var set = global.setImmediate;
@@ -67,7 +68,8 @@ if (!set || !clear) {
67
68
  Dispatch.now(runner(id));
68
69
  };
69
70
  // Browsers with MessageChannel, includes WebWorkers
70
- } else if (MessageChannel) {
71
+ // except iOS - https://github.com/zloirock/core-js/issues/624
72
+ } else if (MessageChannel && !/(iphone|ipod|ipad).*applewebkit/i.test(userAgent)) {
71
73
  channel = new MessageChannel();
72
74
  port = channel.port2;
73
75
  channel.port1.onmessage = listener;
@@ -1,7 +1,7 @@
1
- var toInteger = require('../internals/to-integer');
1
+ var toPositiveInteger = require('../internals/to-positive-integer');
2
2
 
3
3
  module.exports = function (it, BYTES) {
4
- var offset = toInteger(it);
5
- if (offset < 0 || offset % BYTES) throw RangeError('Wrong offset');
4
+ var offset = toPositiveInteger(it);
5
+ if (offset % BYTES) throw RangeError('Wrong offset');
6
6
  return offset;
7
7
  };
@@ -0,0 +1,7 @@
1
+ var toInteger = require('../internals/to-integer');
2
+
3
+ module.exports = function (it) {
4
+ var result = toInteger(it);
5
+ if (result < 0) throw RangeError("The argument can't be less than 0");
6
+ return result;
7
+ };
@@ -7,7 +7,7 @@ var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
7
7
  var ArrayBufferModule = require('../internals/array-buffer');
8
8
  var anInstance = require('../internals/an-instance');
9
9
  var createPropertyDescriptor = require('../internals/create-property-descriptor');
10
- var hide = require('../internals/hide');
10
+ var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
11
11
  var toLength = require('../internals/to-length');
12
12
  var toIndex = require('../internals/to-index');
13
13
  var toOffset = require('../internals/to-offset');
@@ -105,7 +105,6 @@ if (DESCRIPTORS) {
105
105
  defineProperty: wrappedDefineProperty
106
106
  });
107
107
 
108
- // eslint-disable-next-line max-statements
109
108
  module.exports = function (TYPE, BYTES, wrapper, CLAMPED) {
110
109
  var CONSTRUCTOR_NAME = TYPE + (CLAMPED ? 'Clamped' : '') + 'Array';
111
110
  var GETTER = 'get' + TYPE;
@@ -193,16 +192,20 @@ if (DESCRIPTORS) {
193
192
 
194
193
  if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray);
195
194
  forEach(getOwnPropertyNames(NativeTypedArrayConstructor), function (key) {
196
- if (!(key in TypedArrayConstructor)) hide(TypedArrayConstructor, key, NativeTypedArrayConstructor[key]);
195
+ if (!(key in TypedArrayConstructor)) {
196
+ createNonEnumerableProperty(TypedArrayConstructor, key, NativeTypedArrayConstructor[key]);
197
+ }
197
198
  });
198
199
  TypedArrayConstructor.prototype = TypedArrayConstructorPrototype;
199
200
  }
200
201
 
201
202
  if (TypedArrayConstructorPrototype.constructor !== TypedArrayConstructor) {
202
- hide(TypedArrayConstructorPrototype, 'constructor', TypedArrayConstructor);
203
+ createNonEnumerableProperty(TypedArrayConstructorPrototype, 'constructor', TypedArrayConstructor);
203
204
  }
204
205
 
205
- if (TYPED_ARRAY_TAG) hide(TypedArrayConstructorPrototype, TYPED_ARRAY_TAG, CONSTRUCTOR_NAME);
206
+ if (TYPED_ARRAY_TAG) {
207
+ createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_TAG, CONSTRUCTOR_NAME);
208
+ }
206
209
 
207
210
  exported[CONSTRUCTOR_NAME] = TypedArrayConstructor;
208
211
 
@@ -211,11 +214,11 @@ if (DESCRIPTORS) {
211
214
  }, exported);
212
215
 
213
216
  if (!(BYTES_PER_ELEMENT in TypedArrayConstructor)) {
214
- hide(TypedArrayConstructor, BYTES_PER_ELEMENT, BYTES);
217
+ createNonEnumerableProperty(TypedArrayConstructor, BYTES_PER_ELEMENT, BYTES);
215
218
  }
216
219
 
217
220
  if (!(BYTES_PER_ELEMENT in TypedArrayConstructorPrototype)) {
218
- hide(TypedArrayConstructorPrototype, BYTES_PER_ELEMENT, BYTES);
221
+ createNonEnumerableProperty(TypedArrayConstructorPrototype, BYTES_PER_ELEMENT, BYTES);
219
222
  }
220
223
 
221
224
  setSpecies(CONSTRUCTOR_NAME);
@@ -11,11 +11,12 @@ module.exports = function from(source /* , mapfn, thisArg */) {
11
11
  var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
12
12
  var mapping = mapfn !== undefined;
13
13
  var iteratorMethod = getIteratorMethod(O);
14
- var i, length, result, step, iterator;
14
+ var i, length, result, step, iterator, next;
15
15
  if (iteratorMethod != undefined && !isArrayIteratorMethod(iteratorMethod)) {
16
16
  iterator = iteratorMethod.call(O);
17
+ next = iterator.next;
17
18
  O = [];
18
- while (!(step = iterator.next()).done) {
19
+ while (!(step = next.call(iterator)).done) {
19
20
  O.push(step.value);
20
21
  }
21
22
  }
@@ -1,4 +1,4 @@
1
- var hide = require('../internals/hide');
1
+ var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
2
2
  var dateToPrimitive = require('../internals/date-to-primitive');
3
3
  var wellKnownSymbol = require('../internals/well-known-symbol');
4
4
 
@@ -7,4 +7,6 @@ var DatePrototype = Date.prototype;
7
7
 
8
8
  // `Date.prototype[@@toPrimitive]` method
9
9
  // https://tc39.github.io/ecma262/#sec-date.prototype-@@toprimitive
10
- if (!(TO_PRIMITIVE in DatePrototype)) hide(DatePrototype, TO_PRIMITIVE, dateToPrimitive);
10
+ if (!(TO_PRIMITIVE in DatePrototype)) {
11
+ createNonEnumerableProperty(DatePrototype, TO_PRIMITIVE, dateToPrimitive);
12
+ }
@@ -0,0 +1,8 @@
1
+ var $ = require('../internals/export');
2
+ var global = require('../internals/global');
3
+
4
+ // `globalThis` object
5
+ // https://github.com/tc39/proposal-global
6
+ $({ global: true }, {
7
+ globalThis: global
8
+ });
@@ -283,7 +283,8 @@ if (FORCED) {
283
283
  return new PromiseConstructor(function (resolve, reject) {
284
284
  nativeThen.call(that, resolve, reject);
285
285
  }).then(onFulfilled, onRejected);
286
- });
286
+ // https://github.com/zloirock/core-js/issues/640
287
+ }, { unsafe: true });
287
288
 
288
289
  // wrap fetch result
289
290
  if (typeof $fetch == 'function') $({ global: true, enumerable: true, forced: true }, {
@@ -6,8 +6,10 @@ var toLength = require('../internals/to-length');
6
6
  var aFunction = require('../internals/a-function');
7
7
  var anObject = require('../internals/an-object');
8
8
  var classof = require('../internals/classof');
9
- var getFlags = require('../internals/regexp-flags');
10
- var hide = require('../internals/hide');
9
+ var isRegExp = require('../internals/is-regexp');
10
+ var getRegExpFlags = require('../internals/regexp-flags');
11
+ var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
12
+ var fails = require('../internals/fails');
11
13
  var wellKnownSymbol = require('../internals/well-known-symbol');
12
14
  var speciesConstructor = require('../internals/species-constructor');
13
15
  var advanceStringIndex = require('../internals/advance-string-index');
@@ -21,6 +23,11 @@ var setInternalState = InternalStateModule.set;
21
23
  var getInternalState = InternalStateModule.getterFor(REGEXP_STRING_ITERATOR);
22
24
  var RegExpPrototype = RegExp.prototype;
23
25
  var regExpBuiltinExec = RegExpPrototype.exec;
26
+ var nativeMatchAll = ''.matchAll;
27
+
28
+ var WORKS_WITH_NON_GLOBAL_REGEX = !!nativeMatchAll && !fails(function () {
29
+ 'a'.matchAll(/./);
30
+ });
24
31
 
25
32
  var regExpExec = function (R, S) {
26
33
  var exec = R.exec;
@@ -64,7 +71,7 @@ var $matchAll = function (string) {
64
71
  C = speciesConstructor(R, RegExp);
65
72
  flagsValue = R.flags;
66
73
  if (flagsValue === undefined && R instanceof RegExp && !('flags' in RegExpPrototype)) {
67
- flagsValue = getFlags.call(R);
74
+ flagsValue = getRegExpFlags.call(R);
68
75
  }
69
76
  flags = flagsValue === undefined ? '' : String(flagsValue);
70
77
  matcher = new C(C === RegExp ? R.source : R, flags);
@@ -76,19 +83,27 @@ var $matchAll = function (string) {
76
83
 
77
84
  // `String.prototype.matchAll` method
78
85
  // https://github.com/tc39/proposal-string-matchall
79
- $({ target: 'String', proto: true }, {
86
+ $({ target: 'String', proto: true, forced: WORKS_WITH_NON_GLOBAL_REGEX }, {
80
87
  matchAll: function matchAll(regexp) {
81
88
  var O = requireObjectCoercible(this);
82
- var S, matcher, rx;
89
+ var flags, S, matcher, rx;
83
90
  if (regexp != null) {
91
+ if (isRegExp(regexp)) {
92
+ flags = String(requireObjectCoercible('flags' in RegExpPrototype
93
+ ? regexp.flags
94
+ : getRegExpFlags.call(regexp)
95
+ ));
96
+ if (!~flags.indexOf('g')) throw TypeError('`.matchAll` does not allow non-global regexes');
97
+ }
98
+ if (WORKS_WITH_NON_GLOBAL_REGEX) return nativeMatchAll.apply(O, arguments);
84
99
  matcher = regexp[MATCH_ALL];
85
100
  if (matcher === undefined && IS_PURE && classof(regexp) == 'RegExp') matcher = $matchAll;
86
101
  if (matcher != null) return aFunction(matcher).call(regexp, O);
87
- }
102
+ } else if (WORKS_WITH_NON_GLOBAL_REGEX) return nativeMatchAll.apply(O, arguments);
88
103
  S = String(O);
89
104
  rx = new RegExp(regexp, 'g');
90
105
  return IS_PURE ? $matchAll.call(rx, S) : rx[MATCH_ALL](S);
91
106
  }
92
107
  });
93
108
 
94
- IS_PURE || MATCH_ALL in RegExpPrototype || hide(RegExpPrototype, MATCH_ALL, $matchAll);
109
+ IS_PURE || MATCH_ALL in RegExpPrototype || createNonEnumerableProperty(RegExpPrototype, MATCH_ALL, $matchAll);