core-js-pure 3.1.3 → 3.1.4

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 (131) hide show
  1. package/internals/a-possible-prototype.js +7 -0
  2. package/internals/advance-string-index.js +2 -2
  3. package/internals/array-copy-within.js +3 -1
  4. package/internals/array-for-each.js +3 -6
  5. package/internals/array-from.js +1 -1
  6. package/internals/array-includes.js +12 -7
  7. package/internals/{array-methods.js → array-iteration.js} +30 -18
  8. package/internals/array-last-index-of.js +3 -2
  9. package/internals/array-reduce.js +30 -21
  10. package/internals/collection-from.js +3 -2
  11. package/internals/collection-weak.js +5 -5
  12. package/internals/collection.js +1 -2
  13. package/internals/composite-key.js +1 -0
  14. package/internals/date-to-iso-string.js +12 -14
  15. package/internals/document-create-element.js +2 -2
  16. package/internals/function-bind.js +3 -3
  17. package/internals/html.js +2 -4
  18. package/internals/indexed-object.js +1 -1
  19. package/internals/inherit-if-required.js +13 -6
  20. package/internals/iterate.js +18 -10
  21. package/internals/math-expm1.js +2 -1
  22. package/internals/math-fround.js +2 -1
  23. package/internals/math-log1p.js +3 -1
  24. package/internals/not-a-regexp.js +7 -0
  25. package/internals/object-assign.js +2 -1
  26. package/internals/object-create.js +2 -1
  27. package/internals/object-define-properties.js +4 -2
  28. package/internals/object-define-property.js +2 -0
  29. package/internals/object-get-own-property-descriptor.js +2 -0
  30. package/internals/object-get-own-property-names.js +2 -1
  31. package/internals/object-get-prototype-of.js +2 -1
  32. package/internals/object-keys-internal.js +2 -4
  33. package/internals/object-keys.js +2 -1
  34. package/internals/object-property-is-enumerable.js +2 -0
  35. package/internals/object-set-prototype-of.js +9 -5
  36. package/internals/object-to-array.js +25 -15
  37. package/internals/own-keys.js +2 -4
  38. package/internals/parse-float.js +7 -5
  39. package/internals/parse-int.js +6 -4
  40. package/internals/punycode-to-ascii.js +2 -4
  41. package/internals/reflect-metadata.js +1 -0
  42. package/internals/regexp-flags.js +1 -0
  43. package/internals/set-species.js +8 -5
  44. package/internals/string-multibyte.js +27 -0
  45. package/internals/string-pad.js +25 -11
  46. package/internals/string-trim.js +20 -8
  47. package/internals/to-primitive.js +7 -6
  48. package/internals/uid.js +1 -1
  49. package/internals/user-agent.js +2 -4
  50. package/modules/es.array.every.js +3 -6
  51. package/modules/es.array.fill.js +3 -1
  52. package/modules/es.array.filter.js +3 -6
  53. package/modules/es.array.find-index.js +2 -3
  54. package/modules/es.array.find.js +2 -3
  55. package/modules/es.array.flat-map.js +1 -1
  56. package/modules/es.array.flat.js +1 -1
  57. package/modules/es.array.includes.js +2 -4
  58. package/modules/es.array.index-of.js +2 -3
  59. package/modules/es.array.is-array.js +3 -1
  60. package/modules/es.array.map.js +3 -6
  61. package/modules/es.array.reduce-right.js +3 -4
  62. package/modules/es.array.reduce.js +3 -5
  63. package/modules/es.array.slice.js +1 -3
  64. package/modules/es.array.some.js +3 -6
  65. package/modules/es.array.splice.js +1 -3
  66. package/modules/es.map.js +1 -1
  67. package/modules/es.number.to-fixed.js +57 -53
  68. package/modules/es.object.entries.js +2 -2
  69. package/modules/es.object.get-own-property-descriptors.js +3 -3
  70. package/modules/es.object.get-prototype-of.js +1 -0
  71. package/modules/es.object.values.js +2 -2
  72. package/modules/es.promise.js +6 -5
  73. package/modules/es.reflect.apply.js +2 -2
  74. package/modules/es.reflect.construct.js +4 -4
  75. package/modules/es.reflect.define-property.js +5 -5
  76. package/modules/es.reflect.delete-property.js +1 -1
  77. package/modules/es.reflect.get-own-property-descriptor.js +2 -2
  78. package/modules/es.reflect.get-prototype-of.js +1 -1
  79. package/modules/es.reflect.get.js +3 -3
  80. package/modules/es.reflect.set-prototype-of.js +4 -2
  81. package/modules/es.reflect.set.js +3 -3
  82. package/modules/es.set.js +1 -1
  83. package/modules/es.string.code-point-at.js +2 -2
  84. package/modules/es.string.ends-with.js +6 -5
  85. package/modules/es.string.includes.js +4 -3
  86. package/modules/es.string.iterator.js +2 -2
  87. package/modules/es.string.pad-end.js +2 -2
  88. package/modules/es.string.pad-start.js +2 -2
  89. package/modules/es.string.starts-with.js +8 -6
  90. package/modules/es.string.trim-end.js +2 -2
  91. package/modules/es.string.trim-start.js +2 -2
  92. package/modules/es.string.trim.js +3 -5
  93. package/modules/es.symbol.js +93 -85
  94. package/modules/es.weak-map.js +1 -1
  95. package/modules/es.weak-set.js +1 -1
  96. package/modules/esnext.global-this.js +3 -1
  97. package/modules/esnext.map.every.js +4 -5
  98. package/modules/esnext.map.filter.js +4 -5
  99. package/modules/esnext.map.find-key.js +4 -5
  100. package/modules/esnext.map.find.js +4 -5
  101. package/modules/esnext.map.includes.js +4 -7
  102. package/modules/esnext.map.key-of.js +4 -7
  103. package/modules/esnext.map.map-keys.js +4 -5
  104. package/modules/esnext.map.map-values.js +4 -5
  105. package/modules/esnext.map.reduce.js +5 -5
  106. package/modules/esnext.map.some.js +4 -5
  107. package/modules/esnext.map.update.js +3 -2
  108. package/modules/esnext.observable.js +25 -24
  109. package/modules/esnext.reflect.get-metadata-keys.js +1 -0
  110. package/modules/esnext.set.every.js +4 -4
  111. package/modules/esnext.set.filter.js +4 -4
  112. package/modules/esnext.set.find.js +4 -4
  113. package/modules/esnext.set.is-disjoint-from.js +3 -5
  114. package/modules/esnext.set.is-subset-of.js +3 -5
  115. package/modules/esnext.set.is-superset-of.js +3 -5
  116. package/modules/esnext.set.join.js +2 -2
  117. package/modules/esnext.set.map.js +4 -4
  118. package/modules/esnext.set.reduce.js +5 -4
  119. package/modules/esnext.set.some.js +4 -4
  120. package/modules/esnext.string.at.js +2 -2
  121. package/modules/esnext.string.code-points.js +5 -3
  122. package/modules/esnext.string.replace-all.js +4 -4
  123. package/modules/web.immediate.js +5 -0
  124. package/modules/web.timers.js +12 -7
  125. package/modules/web.url-search-params.js +45 -36
  126. package/modules/web.url.js +45 -43
  127. package/package.json +1 -1
  128. package/internals/enum-keys.js +0 -16
  129. package/internals/string-at.js +0 -17
  130. package/internals/validate-set-prototype-of-arguments.js +0 -9
  131. package/internals/validate-string-method-arguments.js +0 -9
@@ -0,0 +1,7 @@
1
+ var isObject = require('../internals/is-object');
2
+
3
+ module.exports = function (it) {
4
+ if (!isObject(it) && it !== null) {
5
+ throw TypeError("Can't set " + String(it) + ' as a prototype');
6
+ } return it;
7
+ };
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
- var codePointAt = require('../internals/string-at');
2
+ var charAt = require('../internals/string-multibyte').charAt;
3
3
 
4
4
  // `AdvanceStringIndex` abstract operation
5
5
  // https://tc39.github.io/ecma262/#sec-advancestringindex
6
6
  module.exports = function (S, index, unicode) {
7
- return index + (unicode ? codePointAt(S, index, true).length : 1);
7
+ return index + (unicode ? charAt(S, index).length : 1);
8
8
  };
@@ -3,6 +3,8 @@ var toObject = require('../internals/to-object');
3
3
  var toAbsoluteIndex = require('../internals/to-absolute-index');
4
4
  var toLength = require('../internals/to-length');
5
5
 
6
+ var min = Math.min;
7
+
6
8
  // `Array.prototype.copyWithin` method implementation
7
9
  // https://tc39.github.io/ecma262/#sec-array.prototype.copywithin
8
10
  module.exports = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) {
@@ -11,7 +13,7 @@ module.exports = [].copyWithin || function copyWithin(target /* = 0 */, start /*
11
13
  var to = toAbsoluteIndex(target, len);
12
14
  var from = toAbsoluteIndex(start, len);
13
15
  var end = arguments.length > 2 ? arguments[2] : undefined;
14
- var count = Math.min((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to);
16
+ var count = min((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to);
15
17
  var inc = 1;
16
18
  if (from < to && to < from + count) {
17
19
  inc = -1;
@@ -1,12 +1,9 @@
1
1
  'use strict';
2
- var arrayMethods = require('../internals/array-methods');
2
+ var $forEach = require('../internals/array-iteration').forEach;
3
3
  var sloppyArrayMethod = require('../internals/sloppy-array-method');
4
4
 
5
- var internalForEach = arrayMethods(0);
6
- var SLOPPY_METHOD = sloppyArrayMethod('forEach');
7
-
8
5
  // `Array.prototype.forEach` method implementation
9
6
  // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
10
- module.exports = SLOPPY_METHOD ? function forEach(callbackfn /* , thisArg */) {
11
- return internalForEach(this, callbackfn, arguments[1]);
7
+ module.exports = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) {
8
+ return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
12
9
  } : [].forEach;
@@ -7,7 +7,7 @@ var toLength = require('../internals/to-length');
7
7
  var createProperty = require('../internals/create-property');
8
8
  var getIteratorMethod = require('../internals/get-iterator-method');
9
9
 
10
- // `Array.from` method
10
+ // `Array.from` method implementation
11
11
  // https://tc39.github.io/ecma262/#sec-array.from
12
12
  module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
13
13
  var O = toObject(arrayLike);
@@ -3,11 +3,7 @@ var toLength = require('../internals/to-length');
3
3
  var toAbsoluteIndex = require('../internals/to-absolute-index');
4
4
 
5
5
  // `Array.prototype.{ indexOf, includes }` methods implementation
6
- // false -> Array#indexOf
7
- // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
8
- // true -> Array#includes
9
- // https://tc39.github.io/ecma262/#sec-array.prototype.includes
10
- module.exports = function (IS_INCLUDES) {
6
+ var createMethod = function (IS_INCLUDES) {
11
7
  return function ($this, el, fromIndex) {
12
8
  var O = toIndexedObject($this);
13
9
  var length = toLength(O.length);
@@ -20,8 +16,17 @@ module.exports = function (IS_INCLUDES) {
20
16
  // eslint-disable-next-line no-self-compare
21
17
  if (value != value) return true;
22
18
  // Array#indexOf ignores holes, Array#includes - not
23
- } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
24
- if (O[index] === el) return IS_INCLUDES || index || 0;
19
+ } else for (;length > index; index++) {
20
+ if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
25
21
  } return !IS_INCLUDES && -1;
26
22
  };
27
23
  };
24
+
25
+ module.exports = {
26
+ // `Array.prototype.includes` method
27
+ // https://tc39.github.io/ecma262/#sec-array.prototype.includes
28
+ includes: createMethod(true),
29
+ // `Array.prototype.indexOf` method
30
+ // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
31
+ indexOf: createMethod(false)
32
+ };
@@ -4,35 +4,23 @@ var toObject = require('../internals/to-object');
4
4
  var toLength = require('../internals/to-length');
5
5
  var arraySpeciesCreate = require('../internals/array-species-create');
6
6
 
7
+ var push = [].push;
8
+
7
9
  // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
8
- // 0 -> Array#forEach
9
- // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
10
- // 1 -> Array#map
11
- // https://tc39.github.io/ecma262/#sec-array.prototype.map
12
- // 2 -> Array#filter
13
- // https://tc39.github.io/ecma262/#sec-array.prototype.filter
14
- // 3 -> Array#some
15
- // https://tc39.github.io/ecma262/#sec-array.prototype.some
16
- // 4 -> Array#every
17
- // https://tc39.github.io/ecma262/#sec-array.prototype.every
18
- // 5 -> Array#find
19
- // https://tc39.github.io/ecma262/#sec-array.prototype.find
20
- // 6 -> Array#findIndex
21
- // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
22
- module.exports = function (TYPE, specificCreate) {
10
+ var createMethod = function (TYPE) {
23
11
  var IS_MAP = TYPE == 1;
24
12
  var IS_FILTER = TYPE == 2;
25
13
  var IS_SOME = TYPE == 3;
26
14
  var IS_EVERY = TYPE == 4;
27
15
  var IS_FIND_INDEX = TYPE == 6;
28
16
  var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
29
- var create = specificCreate || arraySpeciesCreate;
30
- return function ($this, callbackfn, that) {
17
+ return function ($this, callbackfn, that, specificCreate) {
31
18
  var O = toObject($this);
32
19
  var self = IndexedObject(O);
33
20
  var boundFunction = bind(callbackfn, that, 3);
34
21
  var length = toLength(self.length);
35
22
  var index = 0;
23
+ var create = specificCreate || arraySpeciesCreate;
36
24
  var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
37
25
  var value, result;
38
26
  for (;length > index; index++) if (NO_HOLES || index in self) {
@@ -44,10 +32,34 @@ module.exports = function (TYPE, specificCreate) {
44
32
  case 3: return true; // some
45
33
  case 5: return value; // find
46
34
  case 6: return index; // findIndex
47
- case 2: target.push(value); // filter
35
+ case 2: push.call(target, value); // filter
48
36
  } else if (IS_EVERY) return false; // every
49
37
  }
50
38
  }
51
39
  return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
52
40
  };
53
41
  };
42
+
43
+ module.exports = {
44
+ // `Array.prototype.forEach` method
45
+ // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
46
+ forEach: createMethod(0),
47
+ // `Array.prototype.map` method
48
+ // https://tc39.github.io/ecma262/#sec-array.prototype.map
49
+ map: createMethod(1),
50
+ // `Array.prototype.filter` method
51
+ // https://tc39.github.io/ecma262/#sec-array.prototype.filter
52
+ filter: createMethod(2),
53
+ // `Array.prototype.some` method
54
+ // https://tc39.github.io/ecma262/#sec-array.prototype.some
55
+ some: createMethod(3),
56
+ // `Array.prototype.every` method
57
+ // https://tc39.github.io/ecma262/#sec-array.prototype.every
58
+ every: createMethod(4),
59
+ // `Array.prototype.find` method
60
+ // https://tc39.github.io/ecma262/#sec-array.prototype.find
61
+ find: createMethod(5),
62
+ // `Array.prototype.findIndex` method
63
+ // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
64
+ findIndex: createMethod(6)
65
+ };
@@ -4,6 +4,7 @@ var toInteger = require('../internals/to-integer');
4
4
  var toLength = require('../internals/to-length');
5
5
  var sloppyArrayMethod = require('../internals/sloppy-array-method');
6
6
 
7
+ var min = Math.min;
7
8
  var nativeLastIndexOf = [].lastIndexOf;
8
9
  var NEGATIVE_ZERO = !!nativeLastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0;
9
10
  var SLOPPY_METHOD = sloppyArrayMethod('lastIndexOf');
@@ -16,8 +17,8 @@ module.exports = (NEGATIVE_ZERO || SLOPPY_METHOD) ? function lastIndexOf(searchE
16
17
  var O = toIndexedObject(this);
17
18
  var length = toLength(O.length);
18
19
  var index = length - 1;
19
- if (arguments.length > 1) index = Math.min(index, toInteger(arguments[1]));
20
+ if (arguments.length > 1) index = min(index, toInteger(arguments[1]));
20
21
  if (index < 0) index = length + index;
21
- for (;index >= 0; index--) if (index in O) if (O[index] === searchElement) return index || 0;
22
+ for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0;
22
23
  return -1;
23
24
  } : nativeLastIndexOf;
@@ -4,28 +4,37 @@ var IndexedObject = require('../internals/indexed-object');
4
4
  var toLength = require('../internals/to-length');
5
5
 
6
6
  // `Array.prototype.{ reduce, reduceRight }` methods implementation
7
- // https://tc39.github.io/ecma262/#sec-array.prototype.reduce
8
- // https://tc39.github.io/ecma262/#sec-array.prototype.reduceright
9
- module.exports = function (that, callbackfn, argumentsLength, memo, isRight) {
10
- aFunction(callbackfn);
11
- var O = toObject(that);
12
- var self = IndexedObject(O);
13
- var length = toLength(O.length);
14
- var index = isRight ? length - 1 : 0;
15
- var i = isRight ? -1 : 1;
16
- if (argumentsLength < 2) while (true) {
17
- if (index in self) {
18
- memo = self[index];
7
+ var createMethod = function (IS_RIGHT) {
8
+ return function (that, callbackfn, argumentsLength, memo) {
9
+ aFunction(callbackfn);
10
+ var O = toObject(that);
11
+ var self = IndexedObject(O);
12
+ var length = toLength(O.length);
13
+ var index = IS_RIGHT ? length - 1 : 0;
14
+ var i = IS_RIGHT ? -1 : 1;
15
+ if (argumentsLength < 2) while (true) {
16
+ if (index in self) {
17
+ memo = self[index];
18
+ index += i;
19
+ break;
20
+ }
19
21
  index += i;
20
- break;
22
+ if (IS_RIGHT ? index < 0 : length <= index) {
23
+ throw TypeError('Reduce of empty array with no initial value');
24
+ }
21
25
  }
22
- index += i;
23
- if (isRight ? index < 0 : length <= index) {
24
- throw TypeError('Reduce of empty array with no initial value');
26
+ for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
27
+ memo = callbackfn(memo, self[index], index, O);
25
28
  }
26
- }
27
- for (;isRight ? index >= 0 : length > index; index += i) if (index in self) {
28
- memo = callbackfn(memo, self[index], index, O);
29
- }
30
- return memo;
29
+ return memo;
30
+ };
31
+ };
32
+
33
+ module.exports = {
34
+ // `Array.prototype.reduce` method
35
+ // https://tc39.github.io/ecma262/#sec-array.prototype.reduce
36
+ left: createMethod(false),
37
+ // `Array.prototype.reduceRight` method
38
+ // https://tc39.github.io/ecma262/#sec-array.prototype.reduceright
39
+ right: createMethod(true)
31
40
  };
@@ -5,7 +5,8 @@ var bind = require('../internals/bind-context');
5
5
  var iterate = require('../internals/iterate');
6
6
 
7
7
  module.exports = function from(source /* , mapFn, thisArg */) {
8
- var mapFn = arguments[1];
8
+ var length = arguments.length;
9
+ var mapFn = length > 1 ? arguments[1] : undefined;
9
10
  var mapping, A, n, boundFunction;
10
11
  aFunction(this);
11
12
  mapping = mapFn !== undefined;
@@ -14,7 +15,7 @@ module.exports = function from(source /* , mapFn, thisArg */) {
14
15
  A = [];
15
16
  if (mapping) {
16
17
  n = 0;
17
- boundFunction = bind(mapFn, arguments[2], 2);
18
+ boundFunction = bind(mapFn, length > 2 ? arguments[2] : undefined, 2);
18
19
  iterate(source, function (nextItem) {
19
20
  A.push(boundFunction(nextItem, n++));
20
21
  });
@@ -5,14 +5,14 @@ var anObject = require('../internals/an-object');
5
5
  var isObject = require('../internals/is-object');
6
6
  var anInstance = require('../internals/an-instance');
7
7
  var iterate = require('../internals/iterate');
8
- var createArrayMethod = require('../internals/array-methods');
8
+ var ArrayIterationModule = require('../internals/array-iteration');
9
9
  var $has = require('../internals/has');
10
10
  var InternalStateModule = require('../internals/internal-state');
11
11
 
12
12
  var setInternalState = InternalStateModule.set;
13
13
  var internalStateGetterFor = InternalStateModule.getterFor;
14
- var arrayFind = createArrayMethod(5);
15
- var arrayFindIndex = createArrayMethod(6);
14
+ var find = ArrayIterationModule.find;
15
+ var findIndex = ArrayIterationModule.findIndex;
16
16
  var id = 0;
17
17
 
18
18
  // fallback for uncaught frozen keys
@@ -25,7 +25,7 @@ var UncaughtFrozenStore = function () {
25
25
  };
26
26
 
27
27
  var findUncaughtFrozen = function (store, key) {
28
- return arrayFind(store.entries, function (it) {
28
+ return find(store.entries, function (it) {
29
29
  return it[0] === key;
30
30
  });
31
31
  };
@@ -44,7 +44,7 @@ UncaughtFrozenStore.prototype = {
44
44
  else this.entries.push([key, value]);
45
45
  },
46
46
  'delete': function (key) {
47
- var index = arrayFindIndex(this.entries, function (it) {
47
+ var index = findIndex(this.entries, function (it) {
48
48
  return it[0] === key;
49
49
  });
50
50
  if (~index) this.entries.splice(index, 1);
@@ -9,11 +9,10 @@ var anInstance = require('../internals/an-instance');
9
9
  var isObject = require('../internals/is-object');
10
10
  var setToStringTag = require('../internals/set-to-string-tag');
11
11
  var defineProperty = require('../internals/object-define-property').f;
12
- var arrayMethods = require('../internals/array-methods');
12
+ var forEach = require('../internals/array-iteration').forEach;
13
13
  var DESCRIPTORS = require('../internals/descriptors');
14
14
  var InternalStateModule = require('../internals/internal-state');
15
15
 
16
- var forEach = arrayMethods(0);
17
16
  var setInternalState = InternalStateModule.set;
18
17
  var internalStateGetterFor = InternalStateModule.getterFor;
19
18
 
@@ -1,3 +1,4 @@
1
+ // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`
1
2
  var Map = require('../modules/es.map');
2
3
  var WeakMap = require('../modules/es.weak-map');
3
4
  var create = require('../internals/object-create');
@@ -1,13 +1,11 @@
1
1
  'use strict';
2
2
  var fails = require('../internals/fails');
3
+ var padStart = require('../internals/string-pad').start;
3
4
 
4
- var prototype = Date.prototype;
5
- var getTime = prototype.getTime;
6
- var nativeDateToISOString = prototype.toISOString;
7
-
8
- var leadingZero = function (number) {
9
- return number > 9 ? number : '0' + number;
10
- };
5
+ var abs = Math.abs;
6
+ var DatePrototype = Date.prototype;
7
+ var getTime = DatePrototype.getTime;
8
+ var nativeDateToISOString = DatePrototype.toISOString;
11
9
 
12
10
  // `Date.prototype.toISOString` method implementation
13
11
  // https://tc39.github.io/ecma262/#sec-date.prototype.toisostring
@@ -22,12 +20,12 @@ module.exports = (fails(function () {
22
20
  var year = date.getUTCFullYear();
23
21
  var milliseconds = date.getUTCMilliseconds();
24
22
  var sign = year < 0 ? '-' : year > 9999 ? '+' : '';
25
- return sign + ('00000' + Math.abs(year)).slice(sign ? -6 : -4) +
26
- '-' + leadingZero(date.getUTCMonth() + 1) +
27
- '-' + leadingZero(date.getUTCDate()) +
28
- 'T' + leadingZero(date.getUTCHours()) +
29
- ':' + leadingZero(date.getUTCMinutes()) +
30
- ':' + leadingZero(date.getUTCSeconds()) +
31
- '.' + (milliseconds > 99 ? milliseconds : '0' + leadingZero(milliseconds)) +
23
+ return sign + padStart(abs(year), sign ? 6 : 4, 0) +
24
+ '-' + padStart(date.getUTCMonth() + 1, 2, 0) +
25
+ '-' + padStart(date.getUTCDate(), 2, 0) +
26
+ 'T' + padStart(date.getUTCHours(), 2, 0) +
27
+ ':' + padStart(date.getUTCMinutes(), 2, 0) +
28
+ ':' + padStart(date.getUTCSeconds(), 2, 0) +
29
+ '.' + padStart(milliseconds, 3, 0) +
32
30
  'Z';
33
31
  } : nativeDateToISOString;
@@ -3,8 +3,8 @@ var isObject = require('../internals/is-object');
3
3
 
4
4
  var document = global.document;
5
5
  // typeof document.createElement is 'object' in old IE
6
- var exist = isObject(document) && isObject(document.createElement);
6
+ var EXISTS = isObject(document) && isObject(document.createElement);
7
7
 
8
8
  module.exports = function (it) {
9
- return exist ? document.createElement(it) : {};
9
+ return EXISTS ? document.createElement(it) : {};
10
10
  };
@@ -2,7 +2,7 @@
2
2
  var aFunction = require('../internals/a-function');
3
3
  var isObject = require('../internals/is-object');
4
4
 
5
- var arraySlice = [].slice;
5
+ var slice = [].slice;
6
6
  var factories = {};
7
7
 
8
8
  var construct = function (C, argsLength, args) {
@@ -17,9 +17,9 @@ var construct = function (C, argsLength, args) {
17
17
  // https://tc39.github.io/ecma262/#sec-function.prototype.bind
18
18
  module.exports = Function.bind || function bind(that /* , ...args */) {
19
19
  var fn = aFunction(this);
20
- var partArgs = arraySlice.call(arguments, 1);
20
+ var partArgs = slice.call(arguments, 1);
21
21
  var boundFunction = function bound(/* args... */) {
22
- var args = partArgs.concat(arraySlice.call(arguments));
22
+ var args = partArgs.concat(slice.call(arguments));
23
23
  return this instanceof boundFunction ? construct(fn, args.length, args) : fn.apply(that, args);
24
24
  };
25
25
  if (isObject(fn.prototype)) boundFunction.prototype = fn.prototype;
package/internals/html.js CHANGED
@@ -1,5 +1,3 @@
1
- var global = require('../internals/global');
1
+ var getBuiltIn = require('../internals/get-built-in');
2
2
 
3
- var document = global.document;
4
-
5
- module.exports = document && document.documentElement;
3
+ module.exports = getBuiltIn('document', 'documentElement');
@@ -1,9 +1,9 @@
1
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
2
1
  var fails = require('../internals/fails');
3
2
  var classof = require('../internals/classof-raw');
4
3
 
5
4
  var split = ''.split;
6
5
 
6
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
7
7
  module.exports = fails(function () {
8
8
  // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
9
9
  // eslint-disable-next-line no-prototype-builtins
@@ -1,10 +1,17 @@
1
1
  var isObject = require('../internals/is-object');
2
2
  var setPrototypeOf = require('../internals/object-set-prototype-of');
3
3
 
4
- module.exports = function (that, target, C) {
5
- var S = target.constructor;
6
- var P;
7
- if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) {
8
- setPrototypeOf(that, P);
9
- } return that;
4
+ // makes subclassing work correct for wrapped built-ins
5
+ module.exports = function ($this, dummy, Wrapper) {
6
+ var NewTarget, NewTargetPrototype;
7
+ if (
8
+ // it can work only with native `setPrototypeOf`
9
+ setPrototypeOf &&
10
+ // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
11
+ typeof (NewTarget = dummy.constructor) == 'function' &&
12
+ NewTarget !== Wrapper &&
13
+ isObject(NewTargetPrototype = NewTarget.prototype) &&
14
+ NewTargetPrototype !== Wrapper.prototype
15
+ ) setPrototypeOf($this, NewTargetPrototype);
16
+ return $this;
10
17
  };
@@ -5,13 +5,16 @@ var bind = require('../internals/bind-context');
5
5
  var getIteratorMethod = require('../internals/get-iterator-method');
6
6
  var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');
7
7
 
8
- var BREAK = {};
8
+ var Result = function (stopped, result) {
9
+ this.stopped = stopped;
10
+ this.result = result;
11
+ };
9
12
 
10
- var exports = module.exports = function (iterable, fn, that, ENTRIES, ITERATOR) {
11
- var boundFunction = bind(fn, that, ENTRIES ? 2 : 1);
13
+ var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) {
14
+ var boundFunction = bind(fn, that, AS_ENTRIES ? 2 : 1);
12
15
  var iterator, iterFn, index, length, result, step;
13
16
 
14
- if (ITERATOR) {
17
+ if (IS_ITERATOR) {
15
18
  iterator = iterable;
16
19
  } else {
17
20
  iterFn = getIteratorMethod(iterable);
@@ -19,16 +22,21 @@ var exports = module.exports = function (iterable, fn, that, ENTRIES, ITERATOR)
19
22
  // optimisation for array iterators
20
23
  if (isArrayIteratorMethod(iterFn)) {
21
24
  for (index = 0, length = toLength(iterable.length); length > index; index++) {
22
- result = ENTRIES ? boundFunction(anObject(step = iterable[index])[0], step[1]) : boundFunction(iterable[index]);
23
- if (result === BREAK) return BREAK;
24
- } return;
25
+ result = AS_ENTRIES
26
+ ? boundFunction(anObject(step = iterable[index])[0], step[1])
27
+ : boundFunction(iterable[index]);
28
+ if (result && result instanceof Result) return result;
29
+ } return new Result(false);
25
30
  }
26
31
  iterator = iterFn.call(iterable);
27
32
  }
28
33
 
29
34
  while (!(step = iterator.next()).done) {
30
- if (callWithSafeIterationClosing(iterator, boundFunction, step.value, ENTRIES) === BREAK) return BREAK;
31
- }
35
+ result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES);
36
+ if (result && result instanceof Result) return result;
37
+ } return new Result(false);
32
38
  };
33
39
 
34
- exports.BREAK = BREAK;
40
+ iterate.stop = function (result) {
41
+ return new Result(true, result);
42
+ };
@@ -1,4 +1,5 @@
1
1
  var nativeExpm1 = Math.expm1;
2
+ var exp = Math.exp;
2
3
 
3
4
  // `Math.expm1` method implementation
4
5
  // https://tc39.github.io/ecma262/#sec-math.expm1
@@ -8,5 +9,5 @@ module.exports = (!nativeExpm1
8
9
  // Tor Browser bug
9
10
  || nativeExpm1(-2e-17) != -2e-17
10
11
  ) ? function expm1(x) {
11
- return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1;
12
+ return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : exp(x) - 1;
12
13
  } : nativeExpm1;
@@ -1,5 +1,6 @@
1
1
  var sign = require('../internals/math-sign');
2
2
 
3
+ var abs = Math.abs;
3
4
  var pow = Math.pow;
4
5
  var EPSILON = pow(2, -52);
5
6
  var EPSILON32 = pow(2, -23);
@@ -13,7 +14,7 @@ var roundTiesToEven = function (n) {
13
14
  // `Math.fround` method implementation
14
15
  // https://tc39.github.io/ecma262/#sec-math.fround
15
16
  module.exports = Math.fround || function fround(x) {
16
- var $abs = Math.abs(x);
17
+ var $abs = abs(x);
17
18
  var $sign = sign(x);
18
19
  var a, result;
19
20
  if ($abs < MIN32) return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
@@ -1,5 +1,7 @@
1
+ var log = Math.log;
2
+
1
3
  // `Math.log1p` method implementation
2
4
  // https://tc39.github.io/ecma262/#sec-math.log1p
3
5
  module.exports = Math.log1p || function log1p(x) {
4
- return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x);
6
+ return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : log(1 + x);
5
7
  };
@@ -0,0 +1,7 @@
1
+ var isRegExp = require('../internals/is-regexp');
2
+
3
+ module.exports = function (it) {
4
+ if (isRegExp(it)) {
5
+ throw TypeError("The method doesn't accept regular expressions");
6
+ } return it;
7
+ };
@@ -9,7 +9,8 @@ var IndexedObject = require('../internals/indexed-object');
9
9
 
10
10
  var nativeAssign = Object.assign;
11
11
 
12
- // 19.1.2.1 Object.assign(target, source, ...)
12
+ // `Object.assign` method
13
+ // https://tc39.github.io/ecma262/#sec-object.assign
13
14
  // should work with symbols and should have deterministic property order (V8 bug)
14
15
  module.exports = !nativeAssign || fails(function () {
15
16
  var A = {};
@@ -32,7 +32,8 @@ var createDict = function () {
32
32
  return createDict();
33
33
  };
34
34
 
35
- // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
35
+ // `Object.create` method
36
+ // https://tc39.github.io/ecma262/#sec-object.create
36
37
  module.exports = Object.create || function create(O, Properties) {
37
38
  var result;
38
39
  if (O !== null) {
@@ -3,12 +3,14 @@ var definePropertyModule = require('../internals/object-define-property');
3
3
  var anObject = require('../internals/an-object');
4
4
  var objectKeys = require('../internals/object-keys');
5
5
 
6
+ // `Object.defineProperties` method
7
+ // https://tc39.github.io/ecma262/#sec-object.defineproperties
6
8
  module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
7
9
  anObject(O);
8
10
  var keys = objectKeys(Properties);
9
11
  var length = keys.length;
10
- var i = 0;
12
+ var index = 0;
11
13
  var key;
12
- while (length > i) definePropertyModule.f(O, key = keys[i++], Properties[key]);
14
+ while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]);
13
15
  return O;
14
16
  };
@@ -5,6 +5,8 @@ var toPrimitive = require('../internals/to-primitive');
5
5
 
6
6
  var nativeDefineProperty = Object.defineProperty;
7
7
 
8
+ // `Object.defineProperty` method
9
+ // https://tc39.github.io/ecma262/#sec-object.defineproperty
8
10
  exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
9
11
  anObject(O);
10
12
  P = toPrimitive(P, true);
@@ -8,6 +8,8 @@ var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');
8
8
 
9
9
  var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
10
10
 
11
+ // `Object.getOwnPropertyDescriptor` method
12
+ // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
11
13
  exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
12
14
  O = toIndexedObject(O);
13
15
  P = toPrimitive(P, true);
@@ -1,9 +1,10 @@
1
- // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
2
1
  var internalObjectKeys = require('../internals/object-keys-internal');
3
2
  var enumBugKeys = require('../internals/enum-bug-keys');
4
3
 
5
4
  var hiddenKeys = enumBugKeys.concat('length', 'prototype');
6
5
 
6
+ // `Object.getOwnPropertyNames` method
7
+ // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
7
8
  exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
8
9
  return internalObjectKeys(O, hiddenKeys);
9
10
  };
@@ -6,7 +6,8 @@ var CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter');
6
6
  var IE_PROTO = sharedKey('IE_PROTO');
7
7
  var ObjectPrototype = Object.prototype;
8
8
 
9
- // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
9
+ // `Object.getPrototypeOf` method
10
+ // https://tc39.github.io/ecma262/#sec-object.getprototypeof
10
11
  module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
11
12
  O = toObject(O);
12
13
  if (has(O, IE_PROTO)) return O[IE_PROTO];