core-js 3.27.2 → 3.29.0

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 (197) hide show
  1. package/README.md +56 -33
  2. package/actual/array/index.js +4 -3
  3. package/actual/array/to-reversed.js +3 -2
  4. package/actual/array/to-sorted.js +3 -3
  5. package/actual/array/to-spliced.js +3 -2
  6. package/actual/array/virtual/index.js +3 -2
  7. package/actual/array/virtual/to-reversed.js +3 -2
  8. package/actual/array/virtual/to-sorted.js +3 -3
  9. package/actual/array/virtual/to-spliced.js +3 -2
  10. package/actual/array/virtual/with.js +3 -2
  11. package/actual/array/with.js +3 -2
  12. package/actual/array-buffer/constructor.js +3 -0
  13. package/actual/array-buffer/detached.js +2 -0
  14. package/actual/array-buffer/index.js +3 -0
  15. package/actual/array-buffer/transfer-to-fixed-length.js +2 -0
  16. package/actual/array-buffer/transfer.js +2 -0
  17. package/actual/instance/unshift.js +1 -1
  18. package/actual/json/index.js +6 -0
  19. package/actual/json/is-raw-json.js +4 -0
  20. package/actual/json/parse.js +5 -0
  21. package/actual/json/raw-json.js +6 -0
  22. package/actual/typed-array/index.js +1 -1
  23. package/actual/typed-array/methods.js +1 -1
  24. package/actual/typed-array/to-reversed.js +4 -0
  25. package/actual/typed-array/to-sorted.js +4 -1
  26. package/actual/typed-array/with.js +4 -0
  27. package/es/array/index.js +4 -0
  28. package/es/array/to-reversed.js +4 -0
  29. package/es/array/to-sorted.js +5 -0
  30. package/es/array/to-spliced.js +4 -0
  31. package/es/array/virtual/index.js +4 -0
  32. package/es/array/virtual/to-reversed.js +4 -0
  33. package/es/array/virtual/to-sorted.js +5 -0
  34. package/es/array/virtual/to-spliced.js +4 -0
  35. package/es/array/virtual/with.js +4 -0
  36. package/es/array/with.js +4 -0
  37. package/es/index.js +7 -0
  38. package/es/instance/to-reversed.js +9 -0
  39. package/es/instance/to-sorted.js +9 -0
  40. package/es/instance/to-spliced.js +9 -0
  41. package/es/instance/with.js +9 -0
  42. package/es/typed-array/methods.js +3 -0
  43. package/es/typed-array/to-reversed.js +1 -0
  44. package/es/typed-array/to-sorted.js +2 -0
  45. package/es/typed-array/with.js +1 -0
  46. package/features/array-buffer/detached.js +1 -0
  47. package/features/array-buffer/transfer-to-fixed-length.js +1 -0
  48. package/features/array-buffer/transfer.js +1 -0
  49. package/features/function/demethodize.js +1 -0
  50. package/features/function/virtual/demethodize.js +1 -0
  51. package/features/instance/demethodize.js +1 -0
  52. package/features/iterator/range.js +1 -0
  53. package/features/json/is-raw-json.js +1 -0
  54. package/features/json/parse.js +1 -0
  55. package/features/json/raw-json.js +1 -0
  56. package/features/symbol/is-registered.js +1 -0
  57. package/features/symbol/is-well-known.js +1 -0
  58. package/full/array-buffer/detached.js +3 -0
  59. package/full/array-buffer/transfer-to-fixed-length.js +3 -0
  60. package/full/array-buffer/transfer.js +3 -0
  61. package/full/function/demethodize.js +4 -0
  62. package/full/function/index.js +2 -0
  63. package/full/function/virtual/demethodize.js +4 -0
  64. package/full/function/virtual/index.js +2 -0
  65. package/full/index.js +18 -0
  66. package/full/instance/demethodize.js +9 -0
  67. package/full/instance/unshift.js +1 -1
  68. package/full/iterator/index.js +1 -0
  69. package/full/iterator/range.js +6 -0
  70. package/full/json/is-raw-json.js +3 -0
  71. package/full/json/parse.js +3 -0
  72. package/full/json/raw-json.js +3 -0
  73. package/full/symbol/index.js +2 -0
  74. package/full/symbol/is-registered.js +5 -0
  75. package/full/symbol/is-well-known.js +5 -0
  76. package/internals/{disposable-stack-helpers.js → add-disposable-resource.js} +5 -6
  77. package/internals/array-buffer-byte-length.js +12 -0
  78. package/internals/array-buffer-is-detached.js +14 -0
  79. package/internals/array-buffer-transfer.js +35 -0
  80. package/internals/array-buffer-view-core.js +7 -4
  81. package/internals/array-buffer.js +29 -16
  82. package/internals/async-iterator-create-proxy.js +30 -52
  83. package/internals/collection-strong.js +3 -2
  84. package/internals/engine-is-ios.js +1 -0
  85. package/internals/error-stack-clear.js +1 -0
  86. package/internals/function-bind.js +1 -0
  87. package/internals/function-demethodize.js +7 -0
  88. package/internals/function-uncurry-this-accessor.js +9 -0
  89. package/internals/get-json-replacer-function.js +29 -0
  90. package/internals/get-substitution.js +1 -0
  91. package/internals/is-raw-json.js +8 -0
  92. package/internals/native-raw-json.js +8 -0
  93. package/internals/numeric-range-iterator.js +2 -1
  94. package/internals/object-set-prototype-of.js +2 -3
  95. package/internals/parse-json-string.js +55 -0
  96. package/internals/set-size.js +2 -4
  97. package/internals/set-species.js +2 -3
  98. package/internals/shared.js +2 -2
  99. package/internals/string-trim.js +3 -4
  100. package/internals/structured-clone-proper-transfer.js +17 -0
  101. package/internals/typed-array-constructor.js +8 -4
  102. package/internals/url-constructor-detection.js +2 -0
  103. package/modules/es.array.includes.js +1 -0
  104. package/modules/es.array.to-reversed.js +17 -0
  105. package/modules/es.array.to-sorted.js +24 -0
  106. package/modules/es.array.to-spliced.js +44 -0
  107. package/modules/es.array.with.js +14 -0
  108. package/modules/es.date.get-year.js +1 -0
  109. package/modules/es.function.bind.js +1 -0
  110. package/modules/es.function.name.js +2 -2
  111. package/modules/es.json.stringify.js +7 -7
  112. package/modules/es.symbol.constructor.js +2 -1
  113. package/modules/es.symbol.description.js +2 -2
  114. package/modules/es.typed-array.set.js +4 -4
  115. package/modules/es.typed-array.to-reversed.js +13 -0
  116. package/modules/es.typed-array.to-sorted.js +19 -0
  117. package/modules/es.typed-array.with.js +30 -0
  118. package/modules/esnext.array-buffer.detached.js +15 -0
  119. package/modules/esnext.array-buffer.transfer-to-fixed-length.js +11 -0
  120. package/modules/esnext.array-buffer.transfer.js +11 -0
  121. package/modules/esnext.array.to-reversed.js +2 -17
  122. package/modules/esnext.array.to-sorted.js +2 -24
  123. package/modules/esnext.array.to-spliced.js +2 -44
  124. package/modules/esnext.array.with.js +2 -14
  125. package/modules/esnext.async-disposable-stack.constructor.js +3 -11
  126. package/modules/esnext.async-iterator.constructor.js +1 -1
  127. package/modules/esnext.async-iterator.drop.js +1 -1
  128. package/modules/esnext.async-iterator.every.js +1 -1
  129. package/modules/esnext.async-iterator.filter.js +1 -1
  130. package/modules/esnext.async-iterator.find.js +1 -1
  131. package/modules/esnext.async-iterator.flat-map.js +1 -1
  132. package/modules/esnext.async-iterator.for-each.js +1 -1
  133. package/modules/esnext.async-iterator.from.js +1 -1
  134. package/modules/esnext.async-iterator.map.js +1 -1
  135. package/modules/esnext.async-iterator.reduce.js +1 -1
  136. package/modules/esnext.async-iterator.some.js +1 -1
  137. package/modules/esnext.async-iterator.take.js +1 -1
  138. package/modules/esnext.async-iterator.to-array.js +1 -1
  139. package/modules/esnext.bigint.range.js +1 -0
  140. package/modules/esnext.disposable-stack.constructor.js +3 -11
  141. package/modules/esnext.function.demethodize.js +8 -0
  142. package/modules/esnext.function.un-this.js +5 -7
  143. package/modules/esnext.iterator.range.js +16 -0
  144. package/modules/esnext.iterator.to-async.js +1 -1
  145. package/modules/esnext.json.is-raw-json.js +10 -0
  146. package/modules/esnext.json.parse.js +251 -0
  147. package/modules/esnext.json.raw-json.js +84 -0
  148. package/modules/esnext.number.range.js +1 -0
  149. package/modules/esnext.string.to-well-formed.js +10 -1
  150. package/modules/esnext.suppressed-error.constructor.js +1 -3
  151. package/modules/esnext.symbol.is-registered.js +19 -0
  152. package/modules/esnext.symbol.is-well-known.js +36 -0
  153. package/modules/esnext.typed-array.to-reversed.js +2 -13
  154. package/modules/esnext.typed-array.to-sorted.js +2 -19
  155. package/modules/esnext.typed-array.with.js +2 -30
  156. package/modules/web.atob.js +1 -1
  157. package/modules/web.structured-clone.js +8 -16
  158. package/modules/web.url-search-params.constructor.js +16 -1
  159. package/modules/web.url-search-params.size.js +21 -0
  160. package/modules/web.url.constructor.js +4 -2
  161. package/package.json +1 -1
  162. package/postinstall.js +2 -1
  163. package/proposals/array-buffer-transfer.js +3 -0
  164. package/proposals/async-iterator-helpers.js +15 -0
  165. package/proposals/change-array-by-copy-stage-4.js +8 -0
  166. package/proposals/function-demethodize.js +2 -0
  167. package/proposals/function-un-this.js +1 -0
  168. package/proposals/iterator-helpers-stage-3-2.js +14 -0
  169. package/proposals/iterator-range.js +3 -0
  170. package/proposals/json-parse-with-source.js +4 -0
  171. package/proposals/symbol-predicates.js +3 -0
  172. package/proposals/url.js +1 -0
  173. package/stable/array/to-reversed.js +3 -0
  174. package/stable/array/to-sorted.js +3 -0
  175. package/stable/array/to-spliced.js +3 -0
  176. package/stable/array/virtual/to-reversed.js +3 -0
  177. package/stable/array/virtual/to-sorted.js +3 -0
  178. package/stable/array/virtual/to-spliced.js +3 -0
  179. package/stable/array/virtual/with.js +3 -0
  180. package/stable/array/with.js +3 -0
  181. package/stable/index.js +8 -0
  182. package/stable/instance/to-reversed.js +3 -0
  183. package/stable/instance/to-sorted.js +3 -0
  184. package/stable/instance/to-spliced.js +3 -0
  185. package/stable/instance/unshift.js +1 -1
  186. package/stable/instance/with.js +3 -0
  187. package/stable/typed-array/to-reversed.js +3 -0
  188. package/stable/typed-array/to-sorted.js +3 -0
  189. package/stable/typed-array/with.js +3 -0
  190. package/stage/0.js +2 -1
  191. package/stage/1.js +2 -1
  192. package/stage/2.js +2 -0
  193. package/stage/3.js +5 -2
  194. package/stage/4.js +1 -0
  195. package/web/index.js +1 -0
  196. package/web/url-search-params.js +1 -0
  197. package/web/url.js +1 -0
@@ -1,44 +1,2 @@
1
- 'use strict';
2
- var $ = require('../internals/export');
3
- var addToUnscopables = require('../internals/add-to-unscopables');
4
- var doesNotExceedSafeInteger = require('../internals/does-not-exceed-safe-integer');
5
- var lengthOfArrayLike = require('../internals/length-of-array-like');
6
- var toAbsoluteIndex = require('../internals/to-absolute-index');
7
- var toIndexedObject = require('../internals/to-indexed-object');
8
- var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
9
-
10
- var $Array = Array;
11
- var max = Math.max;
12
- var min = Math.min;
13
-
14
- // `Array.prototype.toSpliced` method
15
- // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.toSpliced
16
- $({ target: 'Array', proto: true }, {
17
- toSpliced: function toSpliced(start, deleteCount /* , ...items */) {
18
- var O = toIndexedObject(this);
19
- var len = lengthOfArrayLike(O);
20
- var actualStart = toAbsoluteIndex(start, len);
21
- var argumentsLength = arguments.length;
22
- var k = 0;
23
- var insertCount, actualDeleteCount, newLen, A;
24
- if (argumentsLength === 0) {
25
- insertCount = actualDeleteCount = 0;
26
- } else if (argumentsLength === 1) {
27
- insertCount = 0;
28
- actualDeleteCount = len - actualStart;
29
- } else {
30
- insertCount = argumentsLength - 2;
31
- actualDeleteCount = min(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart);
32
- }
33
- newLen = doesNotExceedSafeInteger(len + insertCount - actualDeleteCount);
34
- A = $Array(newLen);
35
-
36
- for (; k < actualStart; k++) A[k] = O[k];
37
- for (; k < actualStart + insertCount; k++) A[k] = arguments[k - actualStart + 2];
38
- for (; k < newLen; k++) A[k] = O[k + actualDeleteCount - insertCount];
39
-
40
- return A;
41
- }
42
- });
43
-
44
- addToUnscopables('toSpliced');
1
+ // TODO: Remove from `core-js@4`
2
+ require('../modules/es.array.to-spliced');
@@ -1,14 +1,2 @@
1
- 'use strict';
2
- var $ = require('../internals/export');
3
- var arrayWith = require('../internals/array-with');
4
- var toIndexedObject = require('../internals/to-indexed-object');
5
-
6
- var $Array = Array;
7
-
8
- // `Array.prototype.with` method
9
- // https://tc39.es/proposal-change-array-by-copy/#sec-array.prototype.with
10
- $({ target: 'Array', proto: true }, {
11
- 'with': function (index, value) {
12
- return arrayWith(toIndexedObject(this), $Array, index, value);
13
- }
14
- });
1
+ // TODO: Remove from `core-js@4`
2
+ require('../modules/es.array.with');
@@ -4,15 +4,13 @@ var $ = require('../internals/export');
4
4
  var DESCRIPTORS = require('../internals/descriptors');
5
5
  var getBuiltIn = require('../internals/get-built-in');
6
6
  var aCallable = require('../internals/a-callable');
7
- var anObject = require('../internals/an-object');
8
7
  var anInstance = require('../internals/an-instance');
9
- var isNullOrUndefined = require('../internals/is-null-or-undefined');
10
8
  var defineBuiltIn = require('../internals/define-built-in');
11
9
  var defineBuiltIns = require('../internals/define-built-ins');
12
10
  var defineBuiltInAccessor = require('../internals/define-built-in-accessor');
13
11
  var wellKnownSymbol = require('../internals/well-known-symbol');
14
12
  var InternalStateModule = require('../internals/internal-state');
15
- var DisposableStackHelpers = require('../internals/disposable-stack-helpers');
13
+ var addDisposableResource = require('../internals/add-disposable-resource');
16
14
 
17
15
  var Promise = getBuiltIn('Promise');
18
16
  var SuppressedError = getBuiltIn('SuppressedError');
@@ -21,9 +19,6 @@ var $ReferenceError = ReferenceError;
21
19
  var ASYNC_DISPOSE = wellKnownSymbol('asyncDispose');
22
20
  var TO_STRING_TAG = wellKnownSymbol('toStringTag');
23
21
 
24
- var getDisposeMethod = DisposableStackHelpers.getDisposeMethod;
25
- var addDisposableResource = DisposableStackHelpers.addDisposableResource;
26
-
27
22
  var ASYNC_DISPOSABLE_STACK = 'AsyncDisposableStack';
28
23
  var setInternalState = InternalStateModule.set;
29
24
  var getAsyncDisposableStackInternalState = InternalStateModule.getterFor(ASYNC_DISPOSABLE_STACK);
@@ -91,11 +86,8 @@ defineBuiltIns(AsyncDisposableStackPrototype, {
91
86
  use: function use(value) {
92
87
  var internalState = getAsyncDisposableStackInternalState(this);
93
88
  if (internalState.state == DISPOSED) throw $ReferenceError(ALREADY_DISPOSED);
94
- if (!isNullOrUndefined(value)) {
95
- anObject(value);
96
- var method = aCallable(getDisposeMethod(value, HINT));
97
- addDisposableResource(internalState, value, HINT, method);
98
- } return value;
89
+ addDisposableResource(internalState, value, HINT);
90
+ return value;
99
91
  },
100
92
  adopt: function adopt(value, onDispose) {
101
93
  var internalState = getAsyncDisposableStackInternalState(this);
@@ -24,7 +24,7 @@ if (IS_PURE || !hasOwn(AsyncIteratorPrototype, 'constructor') || AsyncIteratorPr
24
24
  }
25
25
 
26
26
  // `AsyncIterator` constructor
27
- // https://github.com/tc39/proposal-iterator-helpers
27
+ // https://github.com/tc39/proposal-async-iterator-helpers
28
28
  $({ global: true, constructor: true, forced: IS_PURE }, {
29
29
  AsyncIterator: AsyncIteratorConstructor
30
30
  });
@@ -38,7 +38,7 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) {
38
38
  });
39
39
 
40
40
  // `AsyncIterator.prototype.drop` method
41
- // https://github.com/tc39/proposal-iterator-helpers
41
+ // https://github.com/tc39/proposal-async-iterator-helpers
42
42
  $({ target: 'AsyncIterator', proto: true, real: true }, {
43
43
  drop: function drop(limit) {
44
44
  return new AsyncIteratorProxy(getIteratorDirect(this), {
@@ -3,7 +3,7 @@ var $ = require('../internals/export');
3
3
  var $every = require('../internals/async-iterator-iteration').every;
4
4
 
5
5
  // `AsyncIterator.prototype.every` method
6
- // https://github.com/tc39/proposal-iterator-helpers
6
+ // https://github.com/tc39/proposal-async-iterator-helpers
7
7
  $({ target: 'AsyncIterator', proto: true, real: true }, {
8
8
  every: function every(predicate) {
9
9
  return $every(this, predicate);
@@ -54,7 +54,7 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) {
54
54
  });
55
55
 
56
56
  // `AsyncIterator.prototype.filter` method
57
- // https://github.com/tc39/proposal-iterator-helpers
57
+ // https://github.com/tc39/proposal-async-iterator-helpers
58
58
  $({ target: 'AsyncIterator', proto: true, real: true }, {
59
59
  filter: function filter(predicate) {
60
60
  return new AsyncIteratorProxy(getIteratorDirect(this), {
@@ -3,7 +3,7 @@ var $ = require('../internals/export');
3
3
  var $find = require('../internals/async-iterator-iteration').find;
4
4
 
5
5
  // `AsyncIterator.prototype.find` method
6
- // https://github.com/tc39/proposal-iterator-helpers
6
+ // https://github.com/tc39/proposal-async-iterator-helpers
7
7
  $({ target: 'AsyncIterator', proto: true, real: true }, {
8
8
  find: function find(predicate) {
9
9
  return $find(this, predicate);
@@ -74,7 +74,7 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) {
74
74
  });
75
75
 
76
76
  // `AsyncIterator.prototype.flaMap` method
77
- // https://github.com/tc39/proposal-iterator-helpers
77
+ // https://github.com/tc39/proposal-async-iterator-helpers
78
78
  $({ target: 'AsyncIterator', proto: true, real: true }, {
79
79
  flatMap: function flatMap(mapper) {
80
80
  return new AsyncIteratorProxy(getIteratorDirect(this), {
@@ -3,7 +3,7 @@ var $ = require('../internals/export');
3
3
  var $forEach = require('../internals/async-iterator-iteration').forEach;
4
4
 
5
5
  // `AsyncIterator.prototype.forEach` method
6
- // https://github.com/tc39/proposal-iterator-helpers
6
+ // https://github.com/tc39/proposal-async-iterator-helpers
7
7
  $({ target: 'AsyncIterator', proto: true, real: true }, {
8
8
  forEach: function forEach(fn) {
9
9
  return $forEach(this, fn);
@@ -6,7 +6,7 @@ var AsyncIteratorPrototype = require('../internals/async-iterator-prototype');
6
6
  var WrapAsyncIterator = require('../internals/async-iterator-wrap');
7
7
 
8
8
  // `AsyncIterator.from` method
9
- // https://github.com/tc39/proposal-iterator-helpers
9
+ // https://github.com/tc39/proposal-async-iterator-helpers
10
10
  $({ target: 'AsyncIterator', stat: true }, {
11
11
  from: function from(O) {
12
12
  var iteratorRecord = getAsyncIteratorFlattenable(typeof O == 'string' ? toObject(O) : O);
@@ -2,7 +2,7 @@ var $ = require('../internals/export');
2
2
  var map = require('../internals/async-iterator-map');
3
3
 
4
4
  // `AsyncIterator.prototype.map` method
5
- // https://github.com/tc39/proposal-iterator-helpers
5
+ // https://github.com/tc39/proposal-async-iterator-helpers
6
6
  $({ target: 'AsyncIterator', proto: true, real: true }, {
7
7
  map: map
8
8
  });
@@ -12,7 +12,7 @@ var Promise = getBuiltIn('Promise');
12
12
  var $TypeError = TypeError;
13
13
 
14
14
  // `AsyncIterator.prototype.reduce` method
15
- // https://github.com/tc39/proposal-iterator-helpers
15
+ // https://github.com/tc39/proposal-async-iterator-helpers
16
16
  $({ target: 'AsyncIterator', proto: true, real: true }, {
17
17
  reduce: function reduce(reducer /* , initialValue */) {
18
18
  var record = getIteratorDirect(this);
@@ -3,7 +3,7 @@ var $ = require('../internals/export');
3
3
  var $some = require('../internals/async-iterator-iteration').some;
4
4
 
5
5
  // `AsyncIterator.prototype.some` method
6
- // https://github.com/tc39/proposal-iterator-helpers
6
+ // https://github.com/tc39/proposal-async-iterator-helpers
7
7
  $({ target: 'AsyncIterator', proto: true, real: true }, {
8
8
  some: function some(predicate) {
9
9
  return $some(this, predicate);
@@ -35,7 +35,7 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (Promise) {
35
35
  });
36
36
 
37
37
  // `AsyncIterator.prototype.take` method
38
- // https://github.com/tc39/proposal-iterator-helpers
38
+ // https://github.com/tc39/proposal-async-iterator-helpers
39
39
  $({ target: 'AsyncIterator', proto: true, real: true }, {
40
40
  take: function take(limit) {
41
41
  return new AsyncIteratorProxy(getIteratorDirect(this), {
@@ -3,7 +3,7 @@ var $ = require('../internals/export');
3
3
  var $toArray = require('../internals/async-iterator-iteration').toArray;
4
4
 
5
5
  // `AsyncIterator.prototype.toArray` method
6
- // https://github.com/tc39/proposal-iterator-helpers
6
+ // https://github.com/tc39/proposal-async-iterator-helpers
7
7
  $({ target: 'AsyncIterator', proto: true, real: true }, {
8
8
  toArray: function toArray() {
9
9
  return $toArray(this, undefined, []);
@@ -5,6 +5,7 @@ var NumericRangeIterator = require('../internals/numeric-range-iterator');
5
5
 
6
6
  // `BigInt.range` method
7
7
  // https://github.com/tc39/proposal-Number.range
8
+ // TODO: Remove from `core-js@4`
8
9
  if (typeof BigInt == 'function') {
9
10
  $({ target: 'BigInt', stat: true, forced: true }, {
10
11
  range: function range(start, end, option) {
@@ -4,15 +4,13 @@ var $ = require('../internals/export');
4
4
  var DESCRIPTORS = require('../internals/descriptors');
5
5
  var getBuiltIn = require('../internals/get-built-in');
6
6
  var aCallable = require('../internals/a-callable');
7
- var anObject = require('../internals/an-object');
8
7
  var anInstance = require('../internals/an-instance');
9
- var isNullOrUndefined = require('../internals/is-null-or-undefined');
10
8
  var defineBuiltIn = require('../internals/define-built-in');
11
9
  var defineBuiltIns = require('../internals/define-built-ins');
12
10
  var defineBuiltInAccessor = require('../internals/define-built-in-accessor');
13
11
  var wellKnownSymbol = require('../internals/well-known-symbol');
14
12
  var InternalStateModule = require('../internals/internal-state');
15
- var DisposableStackHelpers = require('../internals/disposable-stack-helpers');
13
+ var addDisposableResource = require('../internals/add-disposable-resource');
16
14
 
17
15
  var SuppressedError = getBuiltIn('SuppressedError');
18
16
  var $ReferenceError = ReferenceError;
@@ -20,9 +18,6 @@ var $ReferenceError = ReferenceError;
20
18
  var DISPOSE = wellKnownSymbol('dispose');
21
19
  var TO_STRING_TAG = wellKnownSymbol('toStringTag');
22
20
 
23
- var getDisposeMethod = DisposableStackHelpers.getDisposeMethod;
24
- var addDisposableResource = DisposableStackHelpers.addDisposableResource;
25
-
26
21
  var DISPOSABLE_STACK = 'DisposableStack';
27
22
  var setInternalState = InternalStateModule.set;
28
23
  var getDisposableStackInternalState = InternalStateModule.getterFor(DISPOSABLE_STACK);
@@ -75,11 +70,8 @@ defineBuiltIns(DisposableStackPrototype, {
75
70
  use: function use(value) {
76
71
  var internalState = getDisposableStackInternalState(this);
77
72
  if (internalState.state == DISPOSED) throw $ReferenceError(ALREADY_DISPOSED);
78
- if (!isNullOrUndefined(value)) {
79
- anObject(value);
80
- var method = aCallable(getDisposeMethod(value, HINT));
81
- addDisposableResource(internalState, value, HINT, method);
82
- } return value;
73
+ addDisposableResource(internalState, value, HINT);
74
+ return value;
83
75
  },
84
76
  adopt: function adopt(value, onDispose) {
85
77
  var internalState = getDisposableStackInternalState(this);
@@ -0,0 +1,8 @@
1
+ var $ = require('../internals/export');
2
+ var demethodize = require('../internals/function-demethodize');
3
+
4
+ // `Function.prototype.demethodize` method
5
+ // https://github.com/js-choi/proposal-function-demethodize
6
+ $({ target: 'Function', proto: true, forced: true }, {
7
+ demethodize: demethodize
8
+ });
@@ -1,11 +1,9 @@
1
1
  var $ = require('../internals/export');
2
- var uncurryThis = require('../internals/function-uncurry-this');
3
- var aCallable = require('../internals/a-callable');
2
+ var demethodize = require('../internals/function-demethodize');
4
3
 
5
4
  // `Function.prototype.unThis` method
6
- // https://github.com/js-choi/proposal-function-un-this
7
- $({ target: 'Function', proto: true, forced: true }, {
8
- unThis: function unThis() {
9
- return uncurryThis(aCallable(this));
10
- }
5
+ // https://github.com/js-choi/proposal-function-demethodize
6
+ // TODO: Remove from `core-js@4`
7
+ $({ target: 'Function', proto: true, forced: true, name: 'demethodize' }, {
8
+ unThis: demethodize
11
9
  });
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+ /* eslint-disable es/no-bigint -- safe */
3
+ var $ = require('../internals/export');
4
+ var NumericRangeIterator = require('../internals/numeric-range-iterator');
5
+
6
+ var $TypeError = TypeError;
7
+
8
+ // `Iterator.range` method
9
+ // https://github.com/tc39/proposal-Number.range
10
+ $({ target: 'Iterator', stat: true, forced: true }, {
11
+ range: function range(start, end, option) {
12
+ if (typeof start == 'number') return new NumericRangeIterator(start, end, option, 'number', 0, 1);
13
+ if (typeof start == 'bigint') return new NumericRangeIterator(start, end, option, 'bigint', BigInt(0), BigInt(1));
14
+ throw $TypeError('Incorrect Iterator.range arguments');
15
+ }
16
+ });
@@ -5,7 +5,7 @@ var WrapAsyncIterator = require('../internals/async-iterator-wrap');
5
5
  var getIteratorDirect = require('../internals/get-iterator-direct');
6
6
 
7
7
  // `Iterator.prototype.toAsync` method
8
- // https://github.com/tc39/proposal-iterator-helpers
8
+ // https://github.com/tc39/proposal-async-iterator-helpers
9
9
  $({ target: 'Iterator', proto: true, real: true }, {
10
10
  toAsync: function toAsync() {
11
11
  return new WrapAsyncIterator(getIteratorDirect(new AsyncFromSyncIterator(getIteratorDirect(this))));
@@ -0,0 +1,10 @@
1
+ var $ = require('../internals/export');
2
+ var NATIVE_RAW_JSON = require('../internals/native-raw-json');
3
+ var isRawJSON = require('../internals/is-raw-json');
4
+
5
+ // `JSON.parse` method
6
+ // https://tc39.es/proposal-json-parse-with-source/#sec-json.israwjson
7
+ // https://github.com/tc39/proposal-json-parse-with-source
8
+ $({ target: 'JSON', stat: true, forced: !NATIVE_RAW_JSON }, {
9
+ isRawJSON: isRawJSON
10
+ });
@@ -0,0 +1,251 @@
1
+ 'use strict';
2
+ var $ = require('../internals/export');
3
+ var DESCRIPTORS = require('../internals/descriptors');
4
+ var global = require('../internals/global');
5
+ var getBuiltIn = require('../internals/get-built-in');
6
+ var uncurryThis = require('../internals/function-uncurry-this');
7
+ var call = require('../internals/function-call');
8
+ var isCallable = require('../internals/is-callable');
9
+ var isObject = require('../internals/is-object');
10
+ var isArray = require('../internals/is-array');
11
+ var hasOwn = require('../internals/has-own-property');
12
+ var toString = require('../internals/to-string');
13
+ var lengthOfArrayLike = require('../internals/length-of-array-like');
14
+ var createProperty = require('../internals/create-property');
15
+ var fails = require('../internals/fails');
16
+ var parseJSONString = require('../internals/parse-json-string');
17
+ var NATIVE_SYMBOL = require('../internals/symbol-constructor-detection');
18
+
19
+ var JSON = global.JSON;
20
+ var Number = global.Number;
21
+ var SyntaxError = global.SyntaxError;
22
+ var nativeParse = JSON && JSON.parse;
23
+ var enumerableOwnProperties = getBuiltIn('Object', 'keys');
24
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
25
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
26
+ var at = uncurryThis(''.charAt);
27
+ var slice = uncurryThis(''.slice);
28
+ var exec = uncurryThis(/./.exec);
29
+ var push = uncurryThis([].push);
30
+
31
+ var IS_DIGIT = /^\d$/;
32
+ var IS_NON_ZERO_DIGIT = /^[1-9]$/;
33
+ var IS_NUMBER_START = /^(-|\d)$/;
34
+ var IS_WHITESPACE = /^[\t\n\r ]$/;
35
+
36
+ var PRIMITIVE = 0;
37
+ var OBJECT = 1;
38
+
39
+ var $parse = function (source, reviver) {
40
+ source = toString(source);
41
+ var context = new Context(source, 0, '');
42
+ var root = context.parse();
43
+ var value = root.value;
44
+ var endIndex = context.skip(IS_WHITESPACE, root.end);
45
+ if (endIndex < source.length) {
46
+ throw SyntaxError('Unexpected extra character: "' + at(source, endIndex) + '" after the parsed data at: ' + endIndex);
47
+ }
48
+ return isCallable(reviver) ? internalize({ '': value }, '', reviver, root) : value;
49
+ };
50
+
51
+ var internalize = function (holder, name, reviver, node) {
52
+ var val = holder[name];
53
+ var unmodified = node && val === node.value;
54
+ var context = unmodified && typeof node.source == 'string' ? { source: node.source } : {};
55
+ var elementRecordsLen, keys, len, i, P;
56
+ if (isObject(val)) {
57
+ var nodeIsArray = isArray(val);
58
+ var nodes = unmodified ? node.nodes : nodeIsArray ? [] : {};
59
+ if (nodeIsArray) {
60
+ elementRecordsLen = nodes.length;
61
+ len = lengthOfArrayLike(val);
62
+ for (i = 0; i < len; i++) {
63
+ internalizeProperty(val, i, internalize(val, '' + i, reviver, i < elementRecordsLen ? nodes[i] : undefined));
64
+ }
65
+ } else {
66
+ keys = enumerableOwnProperties(val);
67
+ len = lengthOfArrayLike(keys);
68
+ for (i = 0; i < len; i++) {
69
+ P = keys[i];
70
+ internalizeProperty(val, P, internalize(val, P, reviver, hasOwn(nodes, P) ? nodes[P] : undefined));
71
+ }
72
+ }
73
+ }
74
+ return call(reviver, holder, name, val, context);
75
+ };
76
+
77
+ var internalizeProperty = function (object, key, value) {
78
+ if (DESCRIPTORS) {
79
+ var descriptor = getOwnPropertyDescriptor(object, key);
80
+ if (descriptor && !descriptor.configurable) return;
81
+ }
82
+ if (value === undefined) delete object[key];
83
+ else createProperty(object, key, value);
84
+ };
85
+
86
+ var Node = function (value, end, source, nodes) {
87
+ this.value = value;
88
+ this.end = end;
89
+ this.source = source;
90
+ this.nodes = nodes;
91
+ };
92
+
93
+ var Context = function (source, index) {
94
+ this.source = source;
95
+ this.index = index;
96
+ };
97
+
98
+ // https://www.json.org/json-en.html
99
+ Context.prototype = {
100
+ fork: function (nextIndex) {
101
+ return new Context(this.source, nextIndex);
102
+ },
103
+ parse: function () {
104
+ var source = this.source;
105
+ var i = this.skip(IS_WHITESPACE, this.index);
106
+ var fork = this.fork(i);
107
+ var chr = at(source, i);
108
+ if (exec(IS_NUMBER_START, chr)) return fork.number();
109
+ switch (chr) {
110
+ case '{':
111
+ return fork.object();
112
+ case '[':
113
+ return fork.array();
114
+ case '"':
115
+ return fork.string();
116
+ case 't':
117
+ return fork.keyword(true);
118
+ case 'f':
119
+ return fork.keyword(false);
120
+ case 'n':
121
+ return fork.keyword(null);
122
+ } throw SyntaxError('Unexpected character: "' + chr + '" at: ' + i);
123
+ },
124
+ node: function (type, value, start, end, nodes) {
125
+ return new Node(value, end, type ? null : slice(this.source, start, end), nodes);
126
+ },
127
+ object: function () {
128
+ var source = this.source;
129
+ var i = this.index + 1;
130
+ var expectKeypair = false;
131
+ var object = {};
132
+ var nodes = {};
133
+ while (i < source.length) {
134
+ i = this.until(['"', '}'], i);
135
+ if (at(source, i) == '}' && !expectKeypair) {
136
+ i++;
137
+ break;
138
+ }
139
+ // Parsing the key
140
+ var result = this.fork(i).string();
141
+ var key = result.value;
142
+ i = result.end;
143
+ i = this.until([':'], i) + 1;
144
+ // Parsing value
145
+ i = this.skip(IS_WHITESPACE, i);
146
+ result = this.fork(i).parse();
147
+ createProperty(nodes, key, result);
148
+ createProperty(object, key, result.value);
149
+ i = this.until([',', '}'], result.end);
150
+ var chr = at(source, i);
151
+ if (chr == ',') {
152
+ expectKeypair = true;
153
+ i++;
154
+ } else if (chr == '}') {
155
+ i++;
156
+ break;
157
+ }
158
+ }
159
+ return this.node(OBJECT, object, this.index, i, nodes);
160
+ },
161
+ array: function () {
162
+ var source = this.source;
163
+ var i = this.index + 1;
164
+ var expectElement = false;
165
+ var array = [];
166
+ var nodes = [];
167
+ while (i < source.length) {
168
+ i = this.skip(IS_WHITESPACE, i);
169
+ if (at(source, i) == ']' && !expectElement) {
170
+ i++;
171
+ break;
172
+ }
173
+ var result = this.fork(i).parse();
174
+ push(nodes, result);
175
+ push(array, result.value);
176
+ i = this.until([',', ']'], result.end);
177
+ if (at(source, i) == ',') {
178
+ expectElement = true;
179
+ i++;
180
+ } else if (at(source, i) == ']') {
181
+ i++;
182
+ break;
183
+ }
184
+ }
185
+ return this.node(OBJECT, array, this.index, i, nodes);
186
+ },
187
+ string: function () {
188
+ var index = this.index;
189
+ var parsed = parseJSONString(this.source, this.index + 1);
190
+ return this.node(PRIMITIVE, parsed.value, index, parsed.end);
191
+ },
192
+ number: function () {
193
+ var source = this.source;
194
+ var startIndex = this.index;
195
+ var i = startIndex;
196
+ if (at(source, i) == '-') i++;
197
+ if (at(source, i) == '0') i++;
198
+ else if (exec(IS_NON_ZERO_DIGIT, at(source, i))) i = this.skip(IS_DIGIT, ++i);
199
+ else throw SyntaxError('Failed to parse number at: ' + i);
200
+ if (at(source, i) == '.') i = this.skip(IS_DIGIT, ++i);
201
+ if (at(source, i) == 'e' || at(source, i) == 'E') {
202
+ i++;
203
+ if (at(source, i) == '+' || at(source, i) == '-') i++;
204
+ var exponentStartIndex = i;
205
+ i = this.skip(IS_DIGIT, i);
206
+ if (exponentStartIndex == i) throw SyntaxError("Failed to parse number's exponent value at: " + i);
207
+ }
208
+ return this.node(PRIMITIVE, Number(slice(source, startIndex, i)), startIndex, i);
209
+ },
210
+ keyword: function (value) {
211
+ var keyword = '' + value;
212
+ var index = this.index;
213
+ var endIndex = index + keyword.length;
214
+ if (slice(this.source, index, endIndex) != keyword) throw SyntaxError('Failed to parse value at: ' + index);
215
+ return this.node(PRIMITIVE, value, index, endIndex);
216
+ },
217
+ skip: function (regex, i) {
218
+ var source = this.source;
219
+ for (; i < source.length; i++) if (!exec(regex, at(source, i))) break;
220
+ return i;
221
+ },
222
+ until: function (array, i) {
223
+ i = this.skip(IS_WHITESPACE, i);
224
+ var chr = at(this.source, i);
225
+ for (var j = 0; j < array.length; j++) if (array[j] == chr) return i;
226
+ throw SyntaxError('Unexpected character: "' + chr + '" at: ' + i);
227
+ }
228
+ };
229
+
230
+ var NO_SOURCE_SUPPORT = fails(function () {
231
+ var unsafeInt = '9007199254740993';
232
+ var source;
233
+ nativeParse(unsafeInt, function (key, value, context) {
234
+ source = context.source;
235
+ });
236
+ return source !== unsafeInt;
237
+ });
238
+
239
+ var PROPER_BASE_PARSE = NATIVE_SYMBOL && !fails(function () {
240
+ // Safari 9 bug
241
+ return 1 / nativeParse('-0 \t') !== -Infinity;
242
+ });
243
+
244
+ // `JSON.parse` method
245
+ // https://tc39.es/ecma262/#sec-json.parse
246
+ // https://github.com/tc39/proposal-json-parse-with-source
247
+ $({ target: 'JSON', stat: true, forced: NO_SOURCE_SUPPORT }, {
248
+ parse: function parse(text, reviver) {
249
+ return PROPER_BASE_PARSE && !isCallable(reviver) ? nativeParse(text) : $parse(text, reviver);
250
+ }
251
+ });