core-js-pure 3.18.2 → 3.19.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 (293) hide show
  1. package/es/date/to-primitive.js +2 -3
  2. package/es/date/to-string.js +2 -4
  3. package/es/instance/at.js +6 -5
  4. package/es/instance/bind.js +3 -2
  5. package/es/instance/code-point-at.js +4 -3
  6. package/es/instance/concat.js +3 -2
  7. package/es/instance/copy-within.js +3 -2
  8. package/es/instance/ends-with.js +4 -3
  9. package/es/instance/entries.js +3 -2
  10. package/es/instance/every.js +3 -2
  11. package/es/instance/fill.js +3 -2
  12. package/es/instance/filter.js +3 -2
  13. package/es/instance/find-index.js +3 -2
  14. package/es/instance/find.js +3 -2
  15. package/es/instance/flags.js +2 -1
  16. package/es/instance/flat-map.js +3 -2
  17. package/es/instance/flat.js +3 -2
  18. package/es/instance/for-each.js +3 -2
  19. package/es/instance/includes.js +6 -5
  20. package/es/instance/index-of.js +3 -2
  21. package/es/instance/keys.js +3 -2
  22. package/es/instance/last-index-of.js +3 -2
  23. package/es/instance/map.js +3 -2
  24. package/es/instance/match-all.js +4 -3
  25. package/es/instance/pad-end.js +4 -3
  26. package/es/instance/pad-start.js +4 -3
  27. package/es/instance/reduce-right.js +3 -2
  28. package/es/instance/reduce.js +3 -2
  29. package/es/instance/repeat.js +4 -3
  30. package/es/instance/replace-all.js +4 -3
  31. package/es/instance/reverse.js +3 -2
  32. package/es/instance/slice.js +3 -2
  33. package/es/instance/some.js +3 -2
  34. package/es/instance/sort.js +3 -2
  35. package/es/instance/splice.js +3 -2
  36. package/es/instance/starts-with.js +4 -3
  37. package/es/instance/trim-end.js +4 -3
  38. package/es/instance/trim-left.js +4 -3
  39. package/es/instance/trim-right.js +4 -3
  40. package/es/instance/trim-start.js +4 -3
  41. package/es/instance/trim.js +4 -3
  42. package/es/instance/values.js +3 -2
  43. package/es/json/stringify.js +4 -3
  44. package/es/promise/all-settled.js +2 -1
  45. package/es/promise/any.js +2 -1
  46. package/es/regexp/flags.js +3 -4
  47. package/es/regexp/match.js +2 -1
  48. package/es/regexp/replace.js +2 -1
  49. package/es/regexp/search.js +2 -1
  50. package/es/regexp/split.js +2 -1
  51. package/es/regexp/test.js +2 -3
  52. package/es/regexp/to-string.js +2 -3
  53. package/es/string/iterator.js +2 -5
  54. package/features/instance/at.js +6 -5
  55. package/features/instance/code-points.js +4 -3
  56. package/features/instance/filter-out.js +3 -2
  57. package/features/instance/filter-reject.js +3 -2
  58. package/features/instance/find-last-index.js +3 -2
  59. package/features/instance/find-last.js +3 -2
  60. package/features/instance/group-by.js +3 -2
  61. package/features/instance/unique-by.js +3 -2
  62. package/features/map/from.js +3 -2
  63. package/features/map/group-by.js +2 -1
  64. package/features/map/key-by.js +2 -1
  65. package/features/map/of.js +3 -2
  66. package/features/promise/try.js +2 -1
  67. package/features/set/from.js +3 -2
  68. package/features/set/of.js +3 -2
  69. package/features/weak-map/from.js +3 -2
  70. package/features/weak-map/of.js +3 -2
  71. package/features/weak-set/from.js +3 -2
  72. package/features/weak-set/of.js +3 -2
  73. package/internals/a-callable.js +3 -0
  74. package/internals/a-constructor.js +3 -0
  75. package/internals/a-possible-prototype.js +5 -1
  76. package/internals/an-instance.js +8 -3
  77. package/internals/an-object.js +4 -0
  78. package/internals/array-buffer-native.js +1 -1
  79. package/internals/array-buffer-non-extensible.js +10 -0
  80. package/internals/array-from-async.js +1 -1
  81. package/internals/array-from.js +6 -2
  82. package/internals/array-group-by.js +6 -3
  83. package/internals/array-iteration-from-last.js +1 -1
  84. package/internals/array-iteration.js +5 -4
  85. package/internals/array-last-index-of.js +2 -1
  86. package/internals/array-reduce.js +3 -0
  87. package/internals/array-slice-simple.js +17 -0
  88. package/internals/array-slice.js +3 -0
  89. package/internals/array-sort.js +10 -11
  90. package/internals/array-species-constructor.js +2 -0
  91. package/internals/array-unique-by.js +13 -9
  92. package/internals/async-from-sync-iterator.js +4 -3
  93. package/internals/async-iterator-create-proxy.js +4 -3
  94. package/internals/async-iterator-iteration.js +5 -2
  95. package/internals/classof-raw.js +5 -2
  96. package/internals/classof.js +3 -0
  97. package/internals/clear-error-stack.js +20 -0
  98. package/internals/collection-add-all.js +3 -2
  99. package/internals/collection-delete-all.js +3 -2
  100. package/internals/collection-from.js +7 -4
  101. package/internals/collection-of.js +3 -4
  102. package/internals/collection-strong.js +11 -9
  103. package/internals/collection-weak.js +10 -6
  104. package/internals/collection.js +5 -3
  105. package/internals/composite-key.js +9 -2
  106. package/internals/create-html.js +3 -1
  107. package/internals/date-to-iso-string.js +23 -13
  108. package/internals/date-to-primitive.js +3 -0
  109. package/internals/define-iterator.js +2 -1
  110. package/internals/engine-v8-version.js +10 -4
  111. package/internals/error-stack-installable.js +10 -0
  112. package/internals/export.js +6 -4
  113. package/internals/flatten-into-array.js +4 -1
  114. package/internals/function-apply.js +9 -0
  115. package/internals/function-bind-context.js +5 -17
  116. package/internals/function-bind.js +15 -9
  117. package/internals/function-call.js +5 -0
  118. package/internals/function-uncurry-this.js +12 -0
  119. package/internals/get-async-iterator.js +2 -1
  120. package/internals/get-iterator.js +7 -2
  121. package/internals/get-substitution.js +10 -7
  122. package/internals/has-own-property.js +3 -2
  123. package/internals/host-report-errors.js +1 -1
  124. package/internals/ieee754.js +24 -6
  125. package/internals/indexed-object.js +5 -2
  126. package/internals/inspect-source.js +3 -2
  127. package/internals/install-error-cause.js +1 -1
  128. package/internals/internal-metadata.js +4 -7
  129. package/internals/internal-state.js +9 -7
  130. package/internals/is-callable.js +1 -1
  131. package/internals/is-constructor.js +6 -4
  132. package/internals/is-iterable.js +4 -2
  133. package/internals/is-object.js +1 -1
  134. package/internals/is-symbol.js +6 -2
  135. package/internals/iterate.js +14 -6
  136. package/internals/iterator-close.js +2 -1
  137. package/internals/iterator-create-proxy.js +4 -3
  138. package/internals/map-emplace.js +8 -3
  139. package/internals/map-upsert.js +12 -4
  140. package/internals/math-scale.js +9 -12
  141. package/internals/microtask.js +6 -4
  142. package/internals/normalize-string-argument.js +5 -0
  143. package/internals/not-a-regexp.js +3 -0
  144. package/internals/number-parse-float.js +8 -6
  145. package/internals/number-parse-int.js +4 -2
  146. package/internals/numeric-range-iterator.js +4 -0
  147. package/internals/object-assign.js +5 -2
  148. package/internals/object-define-properties.js +3 -1
  149. package/internals/object-define-property.js +2 -0
  150. package/internals/object-get-own-property-descriptor.js +2 -1
  151. package/internals/object-get-own-property-names-external.js +4 -4
  152. package/internals/object-get-prototype-of.js +2 -1
  153. package/internals/object-is-extensible.js +16 -0
  154. package/internals/object-is-prototype-of.js +3 -0
  155. package/internals/object-keys-internal.js +5 -2
  156. package/internals/object-set-prototype-of.js +4 -3
  157. package/internals/object-to-array.js +7 -3
  158. package/internals/ordinary-to-primitive.js +7 -3
  159. package/internals/own-keys.js +4 -1
  160. package/internals/reflect-metadata.js +9 -3
  161. package/internals/regexp-exec-abstract.js +6 -2
  162. package/internals/require-object-coercible.js +4 -0
  163. package/internals/set-global.js +4 -2
  164. package/internals/shared.js +1 -1
  165. package/internals/string-multibyte.js +13 -4
  166. package/internals/string-pad.js +6 -3
  167. package/internals/string-punycode-to-ascii.js +34 -20
  168. package/internals/string-repeat.js +3 -0
  169. package/internals/string-trim.js +4 -2
  170. package/internals/task.js +11 -11
  171. package/internals/this-number-value.js +2 -4
  172. package/internals/to-index.js +3 -0
  173. package/internals/to-object.js +3 -0
  174. package/internals/to-positive-integer.js +3 -0
  175. package/internals/to-primitive.js +4 -1
  176. package/internals/to-property-key.js +1 -1
  177. package/internals/to-string.js +3 -0
  178. package/internals/try-to-string.js +4 -0
  179. package/internals/uid.js +4 -1
  180. package/internals/well-known-symbol.js +5 -1
  181. package/modules/es.aggregate-error.js +27 -11
  182. package/modules/es.array.concat.js +2 -0
  183. package/modules/es.array.index-of.js +7 -5
  184. package/modules/es.array.join.js +3 -2
  185. package/modules/es.array.of.js +3 -1
  186. package/modules/es.array.reduce.js +2 -1
  187. package/modules/es.array.reverse.js +3 -2
  188. package/modules/es.array.slice.js +4 -2
  189. package/modules/es.array.sort.js +7 -4
  190. package/modules/es.array.splice.js +2 -0
  191. package/modules/es.date.get-year.js +3 -2
  192. package/modules/es.date.now.js +6 -1
  193. package/modules/es.date.set-year.js +6 -4
  194. package/modules/es.date.to-json.js +3 -2
  195. package/modules/es.escape.js +12 -5
  196. package/modules/es.function.has-instance.js +3 -2
  197. package/modules/es.json.stringify.js +18 -7
  198. package/modules/es.map.js +1 -1
  199. package/modules/es.number.to-fixed.js +19 -13
  200. package/modules/es.number.to-precision.js +6 -5
  201. package/modules/es.object.is-extensible.js +4 -10
  202. package/modules/es.object.is-frozen.js +6 -2
  203. package/modules/es.object.is-sealed.js +6 -2
  204. package/modules/es.promise.all-settled.js +2 -2
  205. package/modules/es.promise.any.js +5 -4
  206. package/modules/es.promise.js +22 -18
  207. package/modules/es.reflect.apply.js +4 -10
  208. package/modules/es.reflect.construct.js +10 -5
  209. package/modules/es.reflect.get.js +2 -1
  210. package/modules/es.reflect.is-extensible.js +2 -4
  211. package/modules/es.reflect.set.js +2 -1
  212. package/modules/es.set.js +1 -1
  213. package/modules/es.string.at-alternative.js +4 -1
  214. package/modules/es.string.ends-with.js +6 -4
  215. package/modules/es.string.from-code-point.js +7 -4
  216. package/modules/es.string.includes.js +8 -2
  217. package/modules/es.string.match-all.js +25 -19
  218. package/modules/es.string.raw.js +6 -6
  219. package/modules/es.string.replace-all.js +19 -13
  220. package/modules/es.string.starts-with.js +6 -4
  221. package/modules/es.string.substr.js +3 -2
  222. package/modules/es.symbol.js +34 -21
  223. package/modules/es.unescape.js +14 -9
  224. package/modules/es.weak-map.js +15 -15
  225. package/modules/esnext.array.is-template-object.js +1 -1
  226. package/modules/esnext.async-iterator.as-indexed-pairs.js +2 -1
  227. package/modules/esnext.async-iterator.constructor.js +1 -1
  228. package/modules/esnext.async-iterator.drop.js +2 -1
  229. package/modules/esnext.async-iterator.filter.js +2 -1
  230. package/modules/esnext.async-iterator.flat-map.js +3 -2
  231. package/modules/esnext.async-iterator.from.js +4 -4
  232. package/modules/esnext.async-iterator.map.js +2 -1
  233. package/modules/esnext.async-iterator.reduce.js +4 -1
  234. package/modules/esnext.async-iterator.take.js +4 -2
  235. package/modules/esnext.composite-key.js +5 -1
  236. package/modules/esnext.composite-symbol.js +3 -2
  237. package/modules/esnext.iterator.as-indexed-pairs.js +2 -1
  238. package/modules/esnext.iterator.constructor.js +1 -1
  239. package/modules/esnext.iterator.drop.js +4 -2
  240. package/modules/esnext.iterator.filter.js +2 -1
  241. package/modules/esnext.iterator.flat-map.js +7 -3
  242. package/modules/esnext.iterator.from.js +4 -4
  243. package/modules/esnext.iterator.map.js +2 -1
  244. package/modules/esnext.iterator.reduce.js +3 -0
  245. package/modules/esnext.iterator.take.js +2 -1
  246. package/modules/esnext.map.delete-all.js +2 -4
  247. package/modules/esnext.map.emplace.js +2 -2
  248. package/modules/esnext.map.every.js +1 -1
  249. package/modules/esnext.map.filter.js +5 -4
  250. package/modules/esnext.map.find-key.js +1 -1
  251. package/modules/esnext.map.find.js +1 -1
  252. package/modules/esnext.map.group-by.js +6 -2
  253. package/modules/esnext.map.includes.js +1 -1
  254. package/modules/esnext.map.key-by.js +2 -1
  255. package/modules/esnext.map.map-keys.js +5 -4
  256. package/modules/esnext.map.map-values.js +5 -4
  257. package/modules/esnext.map.reduce.js +3 -0
  258. package/modules/esnext.map.some.js +1 -1
  259. package/modules/esnext.map.update-or-insert.js +2 -2
  260. package/modules/esnext.map.update.js +11 -4
  261. package/modules/esnext.map.upsert.js +2 -2
  262. package/modules/esnext.math.seeded-prng.js +3 -1
  263. package/modules/esnext.number.from-string.js +12 -3
  264. package/modules/esnext.observable.js +14 -9
  265. package/modules/esnext.reflect.get-metadata-keys.js +5 -10
  266. package/modules/esnext.set.add-all.js +2 -4
  267. package/modules/esnext.set.delete-all.js +2 -4
  268. package/modules/esnext.set.difference.js +3 -2
  269. package/modules/esnext.set.every.js +1 -1
  270. package/modules/esnext.set.filter.js +4 -3
  271. package/modules/esnext.set.find.js +1 -1
  272. package/modules/esnext.set.intersection.js +3 -2
  273. package/modules/esnext.set.is-disjoint-from.js +3 -2
  274. package/modules/esnext.set.is-subset-of.js +3 -2
  275. package/modules/esnext.set.is-superset-of.js +3 -2
  276. package/modules/esnext.set.join.js +9 -4
  277. package/modules/esnext.set.map.js +5 -4
  278. package/modules/esnext.set.reduce.js +3 -0
  279. package/modules/esnext.set.some.js +1 -1
  280. package/modules/esnext.set.symmetric-difference.js +3 -2
  281. package/modules/esnext.weak-map.delete-all.js +2 -4
  282. package/modules/esnext.weak-map.emplace.js +2 -2
  283. package/modules/esnext.weak-map.upsert.js +2 -2
  284. package/modules/esnext.weak-set.add-all.js +2 -4
  285. package/modules/esnext.weak-set.delete-all.js +2 -4
  286. package/modules/web.timers.js +5 -4
  287. package/modules/web.url-search-params.js +122 -104
  288. package/modules/web.url.js +664 -628
  289. package/package.json +2 -2
  290. package/stable/instance/entries.js +6 -4
  291. package/stable/instance/for-each.js +6 -4
  292. package/stable/instance/keys.js +6 -4
  293. package/stable/instance/values.js +6 -4
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
+ var uncurryThis = require('../internals/function-uncurry-this');
3
4
  var aCallable = require('../internals/a-callable');
4
5
  var toObject = require('../internals/to-object');
5
6
  var lengthOfArrayLike = require('../internals/length-of-array-like');
@@ -13,7 +14,8 @@ var V8 = require('../internals/engine-v8-version');
13
14
  var WEBKIT = require('../internals/engine-webkit-version');
14
15
 
15
16
  var test = [];
16
- var nativeSort = test.sort;
17
+ var un$Sort = uncurryThis(test.sort);
18
+ var push = uncurryThis(test.push);
17
19
 
18
20
  // IE8-
19
21
  var FAILS_ON_UNDEFINED = fails(function () {
@@ -80,17 +82,18 @@ $({ target: 'Array', proto: true, forced: FORCED }, {
80
82
 
81
83
  var array = toObject(this);
82
84
 
83
- if (STABLE_SORT) return comparefn === undefined ? nativeSort.call(array) : nativeSort.call(array, comparefn);
85
+ if (STABLE_SORT) return comparefn === undefined ? un$Sort(array) : un$Sort(array, comparefn);
84
86
 
85
87
  var items = [];
86
88
  var arrayLength = lengthOfArrayLike(array);
87
89
  var itemsLength, index;
88
90
 
89
91
  for (index = 0; index < arrayLength; index++) {
90
- if (index in array) items.push(array[index]);
92
+ if (index in array) push(items, array[index]);
91
93
  }
92
94
 
93
- items = internalSort(items, getSortCompare(comparefn));
95
+ internalSort(items, getSortCompare(comparefn));
96
+
94
97
  itemsLength = items.length;
95
98
  index = 0;
96
99
 
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
+ var global = require('../internals/global');
3
4
  var toAbsoluteIndex = require('../internals/to-absolute-index');
4
5
  var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
5
6
  var lengthOfArrayLike = require('../internals/length-of-array-like');
@@ -10,6 +11,7 @@ var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-specie
10
11
 
11
12
  var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
12
13
 
14
+ var TypeError = global.TypeError;
13
15
  var max = Math.max;
14
16
  var min = Math.min;
15
17
  var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
@@ -1,17 +1,18 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
+ var uncurryThis = require('../internals/function-uncurry-this');
3
4
  var fails = require('../internals/fails');
4
5
 
5
6
  var FORCED = fails(function () {
6
7
  return new Date(16e11).getYear() !== 120;
7
8
  });
8
9
 
9
- var getFullYear = Date.prototype.getFullYear;
10
+ var getFullYear = uncurryThis(Date.prototype.getFullYear);
10
11
 
11
12
  // `Date.prototype.getYear` method
12
13
  // https://tc39.es/ecma262/#sec-date.prototype.getyear
13
14
  $({ target: 'Date', proto: true, forced: FORCED }, {
14
15
  getYear: function getYear() {
15
- return getFullYear.call(this) - 1900;
16
+ return getFullYear(this) - 1900;
16
17
  }
17
18
  });
@@ -1,9 +1,14 @@
1
1
  var $ = require('../internals/export');
2
+ var global = require('../internals/global');
3
+ var uncurryThis = require('../internals/function-uncurry-this');
4
+
5
+ var Date = global.Date;
6
+ var getTime = uncurryThis(Date.prototype.getTime);
2
7
 
3
8
  // `Date.now` method
4
9
  // https://tc39.es/ecma262/#sec-date.now
5
10
  $({ target: 'Date', stat: true }, {
6
11
  now: function now() {
7
- return new Date().getTime();
12
+ return getTime(new Date());
8
13
  }
9
14
  });
@@ -1,18 +1,20 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
+ var uncurryThis = require('../internals/function-uncurry-this');
3
4
  var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
4
5
 
5
- var getTime = Date.prototype.getTime;
6
- var setFullYear = Date.prototype.setFullYear;
6
+ var DatePrototype = Date.prototype;
7
+ var getTime = uncurryThis(DatePrototype.getTime);
8
+ var setFullYear = uncurryThis(DatePrototype.setFullYear);
7
9
 
8
10
  // `Date.prototype.setYear` method
9
11
  // https://tc39.es/ecma262/#sec-date.prototype.setyear
10
12
  $({ target: 'Date', proto: true }, {
11
13
  setYear: function setYear(year) {
12
14
  // validate
13
- getTime.call(this);
15
+ getTime(this);
14
16
  var yi = toIntegerOrInfinity(year);
15
17
  var yyyy = 0 <= yi && yi <= 99 ? yi + 1900 : yi;
16
- return setFullYear.call(this, yyyy);
18
+ return setFullYear(this, yyyy);
17
19
  }
18
20
  });
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
+ var call = require('../internals/function-call');
3
4
  var toObject = require('../internals/to-object');
4
5
  var toPrimitive = require('../internals/to-primitive');
5
6
  var toISOString = require('../internals/date-to-iso-string');
@@ -8,7 +9,7 @@ var fails = require('../internals/fails');
8
9
 
9
10
  var FORCED = fails(function () {
10
11
  return new Date(NaN).toJSON() !== null
11
- || Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) !== 1;
12
+ || call(Date.prototype.toJSON, { toISOString: function () { return 1; } }) !== 1;
12
13
  });
13
14
 
14
15
  // `Date.prototype.toJSON` method
@@ -19,6 +20,6 @@ $({ target: 'Date', proto: true, forced: FORCED }, {
19
20
  var O = toObject(this);
20
21
  var pv = toPrimitive(O, 'number');
21
22
  return typeof pv == 'number' && !isFinite(pv) ? null :
22
- (!('toISOString' in O) && classof(O) == 'Date') ? toISOString.call(O) : O.toISOString();
23
+ (!('toISOString' in O) && classof(O) == 'Date') ? call(toISOString, O) : O.toISOString();
23
24
  }
24
25
  });
@@ -1,11 +1,18 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
+ var uncurryThis = require('../internals/function-uncurry-this');
3
4
  var toString = require('../internals/to-string');
4
5
 
6
+ var charAt = uncurryThis(''.charAt);
7
+ var charCodeAt = uncurryThis(''.charCodeAt);
8
+ var exec = uncurryThis(/./.exec);
9
+ var numberToString = uncurryThis(1.0.toString);
10
+ var toUpperCase = uncurryThis(''.toUpperCase);
11
+
5
12
  var raw = /[\w*+\-./@]/;
6
13
 
7
14
  var hex = function (code, length) {
8
- var result = code.toString(16);
15
+ var result = numberToString(code, 16);
9
16
  while (result.length < length) result = '0' + result;
10
17
  return result;
11
18
  };
@@ -20,15 +27,15 @@ $({ global: true }, {
20
27
  var index = 0;
21
28
  var chr, code;
22
29
  while (index < length) {
23
- chr = str.charAt(index++);
24
- if (raw.test(chr)) {
30
+ chr = charAt(str, index++);
31
+ if (exec(raw, chr)) {
25
32
  result += chr;
26
33
  } else {
27
- code = chr.charCodeAt(0);
34
+ code = charCodeAt(chr, 0);
28
35
  if (code < 256) {
29
36
  result += '%' + hex(code, 2);
30
37
  } else {
31
- result += '%u' + hex(code, 4).toUpperCase();
38
+ result += '%u' + toUpperCase(hex(code, 4));
32
39
  }
33
40
  }
34
41
  } return result;
@@ -13,9 +13,10 @@ var FunctionPrototype = Function.prototype;
13
13
  if (!(HAS_INSTANCE in FunctionPrototype)) {
14
14
  definePropertyModule.f(FunctionPrototype, HAS_INSTANCE, { value: function (O) {
15
15
  if (!isCallable(this) || !isObject(O)) return false;
16
- if (!isObject(this.prototype)) return O instanceof this;
16
+ var P = this.prototype;
17
+ if (!isObject(P)) return O instanceof this;
17
18
  // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
18
- while (O = getPrototypeOf(O)) if (this.prototype === O) return true;
19
+ while (O = getPrototypeOf(O)) if (P === O) return true;
19
20
  return false;
20
21
  } });
21
22
  }
@@ -1,17 +1,27 @@
1
1
  var $ = require('../internals/export');
2
+ var global = require('../internals/global');
2
3
  var getBuiltIn = require('../internals/get-built-in');
4
+ var apply = require('../internals/function-apply');
5
+ var uncurryThis = require('../internals/function-uncurry-this');
3
6
  var fails = require('../internals/fails');
4
7
 
8
+ var Array = global.Array;
5
9
  var $stringify = getBuiltIn('JSON', 'stringify');
6
- var re = /[\uD800-\uDFFF]/g;
10
+ var exec = uncurryThis(/./.exec);
11
+ var charAt = uncurryThis(''.charAt);
12
+ var charCodeAt = uncurryThis(''.charCodeAt);
13
+ var replace = uncurryThis(''.replace);
14
+ var numberToString = uncurryThis(1.0.toString);
15
+
16
+ var tester = /[\uD800-\uDFFF]/g;
7
17
  var low = /^[\uD800-\uDBFF]$/;
8
18
  var hi = /^[\uDC00-\uDFFF]$/;
9
19
 
10
20
  var fix = function (match, offset, string) {
11
- var prev = string.charAt(offset - 1);
12
- var next = string.charAt(offset + 1);
13
- if ((low.test(match) && !hi.test(next)) || (hi.test(match) && !low.test(prev))) {
14
- return '\\u' + match.charCodeAt(0).toString(16);
21
+ var prev = charAt(string, offset - 1);
22
+ var next = charAt(string, offset + 1);
23
+ if ((exec(low, match) && !exec(hi, next)) || (exec(hi, match) && !exec(low, prev))) {
24
+ return '\\u' + numberToString(charCodeAt(match, 0), 16);
15
25
  } return match;
16
26
  };
17
27
 
@@ -27,8 +37,9 @@ if ($stringify) {
27
37
  $({ target: 'JSON', stat: true, forced: FORCED }, {
28
38
  // eslint-disable-next-line no-unused-vars -- required for `.length`
29
39
  stringify: function stringify(it, replacer, space) {
30
- var result = $stringify.apply(null, arguments);
31
- return typeof result == 'string' ? result.replace(re, fix) : result;
40
+ for (var i = 0, l = arguments.length, args = Array(l); i < l; i++) args[i] = arguments[i];
41
+ var result = apply($stringify, null, args);
42
+ return typeof result == 'string' ? replace(result, tester, fix) : result;
32
43
  }
33
44
  });
34
45
  }
package/modules/es.map.js CHANGED
@@ -4,6 +4,6 @@ var collectionStrong = require('../internals/collection-strong');
4
4
 
5
5
  // `Map` constructor
6
6
  // https://tc39.es/ecma262/#sec-map-objects
7
- module.exports = collection('Map', function (init) {
7
+ collection('Map', function (init) {
8
8
  return function Map() { return init(this, arguments.length ? arguments[0] : undefined); };
9
9
  }, collectionStrong);
@@ -1,12 +1,18 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
+ var global = require('../internals/global');
4
+ var uncurryThis = require('../internals/function-uncurry-this');
3
5
  var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
4
6
  var thisNumberValue = require('../internals/this-number-value');
5
- var repeat = require('../internals/string-repeat');
7
+ var $repeat = require('../internals/string-repeat');
6
8
  var fails = require('../internals/fails');
7
9
 
8
- var nativeToFixed = 1.0.toFixed;
10
+ var RangeError = global.RangeError;
11
+ var String = global.String;
9
12
  var floor = Math.floor;
13
+ var repeat = uncurryThis($repeat);
14
+ var stringSlice = uncurryThis(''.slice);
15
+ var un$ToFixed = uncurryThis(1.0.toFixed);
10
16
 
11
17
  var pow = function (x, n, acc) {
12
18
  return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
@@ -51,19 +57,19 @@ var dataToString = function (data) {
51
57
  while (--index >= 0) {
52
58
  if (s !== '' || index === 0 || data[index] !== 0) {
53
59
  var t = String(data[index]);
54
- s = s === '' ? t : s + repeat.call('0', 7 - t.length) + t;
60
+ s = s === '' ? t : s + repeat('0', 7 - t.length) + t;
55
61
  }
56
62
  } return s;
57
63
  };
58
64
 
59
- var FORCED = nativeToFixed && (
60
- 0.00008.toFixed(3) !== '0.000' ||
61
- 0.9.toFixed(0) !== '1' ||
62
- 1.255.toFixed(2) !== '1.25' ||
63
- 1000000000000000128.0.toFixed(0) !== '1000000000000000128'
64
- ) || !fails(function () {
65
+ var FORCED = fails(function () {
66
+ return un$ToFixed(0.00008, 3) !== '0.000' ||
67
+ un$ToFixed(0.9, 0) !== '1' ||
68
+ un$ToFixed(1.255, 2) !== '1.25' ||
69
+ un$ToFixed(1000000000000000128.0, 0) !== '1000000000000000128';
70
+ }) || !fails(function () {
65
71
  // V8 ~ Android 4.3-
66
- nativeToFixed.call({});
72
+ un$ToFixed({});
67
73
  });
68
74
 
69
75
  // `Number.prototype.toFixed` method
@@ -110,14 +116,14 @@ $({ target: 'Number', proto: true, forced: FORCED }, {
110
116
  } else {
111
117
  multiply(data, 0, z);
112
118
  multiply(data, 1 << -e, 0);
113
- result = dataToString(data) + repeat.call('0', fractDigits);
119
+ result = dataToString(data) + repeat('0', fractDigits);
114
120
  }
115
121
  }
116
122
  if (fractDigits > 0) {
117
123
  k = result.length;
118
124
  result = sign + (k <= fractDigits
119
- ? '0.' + repeat.call('0', fractDigits - k) + result
120
- : result.slice(0, k - fractDigits) + '.' + result.slice(k - fractDigits));
125
+ ? '0.' + repeat('0', fractDigits - k) + result
126
+ : stringSlice(result, 0, k - fractDigits) + '.' + stringSlice(result, k - fractDigits));
121
127
  } else {
122
128
  result = sign + result;
123
129
  } return result;
@@ -1,16 +1,17 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
+ var uncurryThis = require('../internals/function-uncurry-this');
3
4
  var fails = require('../internals/fails');
4
5
  var thisNumberValue = require('../internals/this-number-value');
5
6
 
6
- var nativeToPrecision = 1.0.toPrecision;
7
+ var un$ToPrecision = uncurryThis(1.0.toPrecision);
7
8
 
8
9
  var FORCED = fails(function () {
9
10
  // IE7-
10
- return nativeToPrecision.call(1, undefined) !== '1';
11
+ return un$ToPrecision(1, undefined) !== '1';
11
12
  }) || !fails(function () {
12
13
  // V8 ~ Android 4.3-
13
- nativeToPrecision.call({});
14
+ un$ToPrecision({});
14
15
  });
15
16
 
16
17
  // `Number.prototype.toPrecision` method
@@ -18,7 +19,7 @@ var FORCED = fails(function () {
18
19
  $({ target: 'Number', proto: true, forced: FORCED }, {
19
20
  toPrecision: function toPrecision(precision) {
20
21
  return precision === undefined
21
- ? nativeToPrecision.call(thisNumberValue(this))
22
- : nativeToPrecision.call(thisNumberValue(this), precision);
22
+ ? un$ToPrecision(thisNumberValue(this))
23
+ : un$ToPrecision(thisNumberValue(this), precision);
23
24
  }
24
25
  });
@@ -1,15 +1,9 @@
1
1
  var $ = require('../internals/export');
2
- var fails = require('../internals/fails');
3
- var isObject = require('../internals/is-object');
4
-
5
- // eslint-disable-next-line es/no-object-isextensible -- safe
6
- var $isExtensible = Object.isExtensible;
7
- var FAILS_ON_PRIMITIVES = fails(function () { $isExtensible(1); });
2
+ var $isExtensible = require('../internals/object-is-extensible');
8
3
 
9
4
  // `Object.isExtensible` method
10
5
  // https://tc39.es/ecma262/#sec-object.isextensible
11
- $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
12
- isExtensible: function isExtensible(it) {
13
- return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false;
14
- }
6
+ // eslint-disable-next-line es/no-object-isextensible -- safe
7
+ $({ target: 'Object', stat: true, forced: Object.isExtensible !== $isExtensible }, {
8
+ isExtensible: $isExtensible
15
9
  });
@@ -1,6 +1,8 @@
1
1
  var $ = require('../internals/export');
2
2
  var fails = require('../internals/fails');
3
3
  var isObject = require('../internals/is-object');
4
+ var classof = require('../internals/classof-raw');
5
+ var ARRAY_BUFFER_NON_EXTENSIBLE = require('../internals/array-buffer-non-extensible');
4
6
 
5
7
  // eslint-disable-next-line es/no-object-isfrozen -- safe
6
8
  var $isFrozen = Object.isFrozen;
@@ -8,8 +10,10 @@ var FAILS_ON_PRIMITIVES = fails(function () { $isFrozen(1); });
8
10
 
9
11
  // `Object.isFrozen` method
10
12
  // https://tc39.es/ecma262/#sec-object.isfrozen
11
- $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
13
+ $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE }, {
12
14
  isFrozen: function isFrozen(it) {
13
- return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true;
15
+ if (!isObject(it)) return true;
16
+ if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return true;
17
+ return $isFrozen ? $isFrozen(it) : false;
14
18
  }
15
19
  });
@@ -1,6 +1,8 @@
1
1
  var $ = require('../internals/export');
2
2
  var fails = require('../internals/fails');
3
3
  var isObject = require('../internals/is-object');
4
+ var classof = require('../internals/classof-raw');
5
+ var ARRAY_BUFFER_NON_EXTENSIBLE = require('../internals/array-buffer-non-extensible');
4
6
 
5
7
  // eslint-disable-next-line es/no-object-issealed -- safe
6
8
  var $isSealed = Object.isSealed;
@@ -8,8 +10,10 @@ var FAILS_ON_PRIMITIVES = fails(function () { $isSealed(1); });
8
10
 
9
11
  // `Object.isSealed` method
10
12
  // https://tc39.es/ecma262/#sec-object.issealed
11
- $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
13
+ $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE }, {
12
14
  isSealed: function isSealed(it) {
13
- return isObject(it) ? $isSealed ? $isSealed(it) : false : true;
15
+ if (!isObject(it)) return true;
16
+ if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return true;
17
+ return $isSealed ? $isSealed(it) : false;
14
18
  }
15
19
  });
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
+ var call = require('../internals/function-call');
3
4
  var aCallable = require('../internals/a-callable');
4
5
  var newPromiseCapabilityModule = require('../internals/new-promise-capability');
5
6
  var perform = require('../internals/perform');
@@ -21,9 +22,8 @@ $({ target: 'Promise', stat: true }, {
21
22
  iterate(iterable, function (promise) {
22
23
  var index = counter++;
23
24
  var alreadyCalled = false;
24
- values.push(undefined);
25
25
  remaining++;
26
- promiseResolve.call(C, promise).then(function (value) {
26
+ call(promiseResolve, C, promise).then(function (value) {
27
27
  if (alreadyCalled) return;
28
28
  alreadyCalled = true;
29
29
  values[index] = { status: 'fulfilled', value: value };
@@ -2,6 +2,7 @@
2
2
  var $ = require('../internals/export');
3
3
  var aCallable = require('../internals/a-callable');
4
4
  var getBuiltIn = require('../internals/get-built-in');
5
+ var call = require('../internals/function-call');
5
6
  var newPromiseCapabilityModule = require('../internals/new-promise-capability');
6
7
  var perform = require('../internals/perform');
7
8
  var iterate = require('../internals/iterate');
@@ -13,6 +14,7 @@ var PROMISE_ANY_ERROR = 'No one promise resolved';
13
14
  $({ target: 'Promise', stat: true }, {
14
15
  any: function any(iterable) {
15
16
  var C = this;
17
+ var AggregateError = getBuiltIn('AggregateError');
16
18
  var capability = newPromiseCapabilityModule.f(C);
17
19
  var resolve = capability.resolve;
18
20
  var reject = capability.reject;
@@ -25,9 +27,8 @@ $({ target: 'Promise', stat: true }, {
25
27
  iterate(iterable, function (promise) {
26
28
  var index = counter++;
27
29
  var alreadyRejected = false;
28
- errors.push(undefined);
29
30
  remaining++;
30
- promiseResolve.call(C, promise).then(function (value) {
31
+ call(promiseResolve, C, promise).then(function (value) {
31
32
  if (alreadyRejected || alreadyResolved) return;
32
33
  alreadyResolved = true;
33
34
  resolve(value);
@@ -35,10 +36,10 @@ $({ target: 'Promise', stat: true }, {
35
36
  if (alreadyRejected || alreadyResolved) return;
36
37
  alreadyRejected = true;
37
38
  errors[index] = error;
38
- --remaining || reject(new (getBuiltIn('AggregateError'))(errors, PROMISE_ANY_ERROR));
39
+ --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
39
40
  });
40
41
  });
41
- --remaining || reject(new (getBuiltIn('AggregateError'))(errors, PROMISE_ANY_ERROR));
42
+ --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));
42
43
  });
43
44
  if (result.error) reject(result.value);
44
45
  return capability.promise;
@@ -3,6 +3,7 @@ var $ = require('../internals/export');
3
3
  var IS_PURE = require('../internals/is-pure');
4
4
  var global = require('../internals/global');
5
5
  var getBuiltIn = require('../internals/get-built-in');
6
+ var call = require('../internals/function-call');
6
7
  var NativePromise = require('../internals/native-promise-constructor');
7
8
  var redefine = require('../internals/redefine');
8
9
  var redefineAll = require('../internals/redefine-all');
@@ -32,17 +33,19 @@ var V8_VERSION = require('../internals/engine-v8-version');
32
33
 
33
34
  var SPECIES = wellKnownSymbol('species');
34
35
  var PROMISE = 'Promise';
36
+
35
37
  var getInternalState = InternalStateModule.get;
36
38
  var setInternalState = InternalStateModule.set;
37
39
  var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
38
40
  var NativePromisePrototype = NativePromise && NativePromise.prototype;
39
41
  var PromiseConstructor = NativePromise;
40
- var PromiseConstructorPrototype = NativePromisePrototype;
42
+ var PromisePrototype = NativePromisePrototype;
41
43
  var TypeError = global.TypeError;
42
44
  var document = global.document;
43
45
  var process = global.process;
44
46
  var newPromiseCapability = newPromiseCapabilityModule.f;
45
47
  var newGenericPromiseCapability = newPromiseCapability;
48
+
46
49
  var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
47
50
  var NATIVE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent);
48
51
  var UNHANDLED_REJECTION = 'unhandledrejection';
@@ -53,6 +56,7 @@ var REJECTED = 2;
53
56
  var HANDLED = 1;
54
57
  var UNHANDLED = 2;
55
58
  var SUBCLASSING = false;
59
+
56
60
  var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
57
61
 
58
62
  var FORCED = isForced(PROMISE, function () {
@@ -63,7 +67,7 @@ var FORCED = isForced(PROMISE, function () {
63
67
  // We can't detect it synchronously, so just check versions
64
68
  if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
65
69
  // We need Promise#finally in the pure version for preventing prototype pollution
66
- if (IS_PURE && !PromiseConstructorPrototype['finally']) return true;
70
+ if (IS_PURE && !PromisePrototype['finally']) return true;
67
71
  // We can't use @@species feature detection in V8 since it causes
68
72
  // deoptimization and performance degradation
69
73
  // https://github.com/zloirock/core-js/issues/679
@@ -125,7 +129,7 @@ var notify = function (state, isReject) {
125
129
  if (result === reaction.promise) {
126
130
  reject(TypeError('Promise-chain cycle'));
127
131
  } else if (then = isThenable(result)) {
128
- then.call(result, resolve, reject);
132
+ call(then, result, resolve, reject);
129
133
  } else resolve(result);
130
134
  } else reject(value);
131
135
  } catch (error) {
@@ -153,7 +157,7 @@ var dispatchEvent = function (name, promise, reason) {
153
157
  };
154
158
 
155
159
  var onUnhandled = function (state) {
156
- task.call(global, function () {
160
+ call(task, global, function () {
157
161
  var promise = state.facade;
158
162
  var value = state.value;
159
163
  var IS_UNHANDLED = isUnhandled(state);
@@ -176,7 +180,7 @@ var isUnhandled = function (state) {
176
180
  };
177
181
 
178
182
  var onHandleUnhandled = function (state) {
179
- task.call(global, function () {
183
+ call(task, global, function () {
180
184
  var promise = state.facade;
181
185
  if (IS_NODE) {
182
186
  process.emit('rejectionHandled', promise);
@@ -210,7 +214,7 @@ var internalResolve = function (state, value, unwrap) {
210
214
  microtask(function () {
211
215
  var wrapper = { done: false };
212
216
  try {
213
- then.call(value,
217
+ call(then, value,
214
218
  bind(internalResolve, wrapper, state),
215
219
  bind(internalReject, wrapper, state)
216
220
  );
@@ -232,9 +236,9 @@ var internalResolve = function (state, value, unwrap) {
232
236
  if (FORCED) {
233
237
  // 25.4.3.1 Promise(executor)
234
238
  PromiseConstructor = function Promise(executor) {
235
- anInstance(this, PromiseConstructor, PROMISE);
239
+ anInstance(this, PromisePrototype);
236
240
  aCallable(executor);
237
- Internal.call(this);
241
+ call(Internal, this);
238
242
  var state = getInternalState(this);
239
243
  try {
240
244
  executor(bind(internalResolve, state), bind(internalReject, state));
@@ -242,7 +246,7 @@ if (FORCED) {
242
246
  internalReject(state, error);
243
247
  }
244
248
  };
245
- PromiseConstructorPrototype = PromiseConstructor.prototype;
249
+ PromisePrototype = PromiseConstructor.prototype;
246
250
  // eslint-disable-next-line no-unused-vars -- required for `.length`
247
251
  Internal = function Promise(executor) {
248
252
  setInternalState(this, {
@@ -256,17 +260,18 @@ if (FORCED) {
256
260
  value: undefined
257
261
  });
258
262
  };
259
- Internal.prototype = redefineAll(PromiseConstructorPrototype, {
263
+ Internal.prototype = redefineAll(PromisePrototype, {
260
264
  // `Promise.prototype.then` method
261
265
  // https://tc39.es/ecma262/#sec-promise.prototype.then
262
266
  then: function then(onFulfilled, onRejected) {
263
267
  var state = getInternalPromiseState(this);
268
+ var reactions = state.reactions;
264
269
  var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
265
270
  reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
266
271
  reaction.fail = isCallable(onRejected) && onRejected;
267
272
  reaction.domain = IS_NODE ? process.domain : undefined;
268
273
  state.parent = true;
269
- state.reactions.push(reaction);
274
+ reactions[reactions.length] = reaction;
270
275
  if (state.state != PENDING) notify(state, false);
271
276
  return reaction.promise;
272
277
  },
@@ -297,13 +302,13 @@ if (FORCED) {
297
302
  redefine(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
298
303
  var that = this;
299
304
  return new PromiseConstructor(function (resolve, reject) {
300
- nativeThen.call(that, resolve, reject);
305
+ call(nativeThen, that, resolve, reject);
301
306
  }).then(onFulfilled, onRejected);
302
307
  // https://github.com/zloirock/core-js/issues/640
303
308
  }, { unsafe: true });
304
309
 
305
310
  // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
306
- redefine(NativePromisePrototype, 'catch', PromiseConstructorPrototype['catch'], { unsafe: true });
311
+ redefine(NativePromisePrototype, 'catch', PromisePrototype['catch'], { unsafe: true });
307
312
  }
308
313
 
309
314
  // make `.constructor === Promise` work for native promise-based APIs
@@ -313,7 +318,7 @@ if (FORCED) {
313
318
 
314
319
  // make `instanceof Promise` work for native promise-based APIs
315
320
  if (setPrototypeOf) {
316
- setPrototypeOf(NativePromisePrototype, PromiseConstructorPrototype);
321
+ setPrototypeOf(NativePromisePrototype, PromisePrototype);
317
322
  }
318
323
  }
319
324
  }
@@ -333,7 +338,7 @@ $({ target: PROMISE, stat: true, forced: FORCED }, {
333
338
  // https://tc39.es/ecma262/#sec-promise.reject
334
339
  reject: function reject(r) {
335
340
  var capability = newPromiseCapability(this);
336
- capability.reject.call(undefined, r);
341
+ call(capability.reject, undefined, r);
337
342
  return capability.promise;
338
343
  }
339
344
  });
@@ -362,9 +367,8 @@ $({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
362
367
  iterate(iterable, function (promise) {
363
368
  var index = counter++;
364
369
  var alreadyCalled = false;
365
- values.push(undefined);
366
370
  remaining++;
367
- $promiseResolve.call(C, promise).then(function (value) {
371
+ call($promiseResolve, C, promise).then(function (value) {
368
372
  if (alreadyCalled) return;
369
373
  alreadyCalled = true;
370
374
  values[index] = value;
@@ -385,7 +389,7 @@ $({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
385
389
  var result = perform(function () {
386
390
  var $promiseResolve = aCallable(C.resolve);
387
391
  iterate(iterable, function (promise) {
388
- $promiseResolve.call(C, promise).then(capability.resolve, reject);
392
+ call($promiseResolve, C, promise).then(capability.resolve, reject);
389
393
  });
390
394
  });
391
395
  if (result.error) reject(result.value);