core-js 2.1.5 → 2.3.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 (176) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +93 -68
  3. package/bower.json +1 -1
  4. package/build/config.js +3 -6
  5. package/client/core.js +1382 -1102
  6. package/client/core.min.js +4 -4
  7. package/client/core.min.js.map +1 -1
  8. package/client/library.js +1314 -1049
  9. package/client/library.min.js +4 -4
  10. package/client/library.min.js.map +1 -1
  11. package/client/shim.js +1326 -1046
  12. package/client/shim.min.js +4 -4
  13. package/client/shim.min.js.map +1 -1
  14. package/es6/date.js +1 -0
  15. package/es6/index.js +3 -2
  16. package/es7/asap.js +2 -0
  17. package/es7/index.js +8 -0
  18. package/es7/object.js +4 -0
  19. package/es7/string.js +1 -0
  20. package/es7/symbol.js +3 -0
  21. package/fn/asap.js +2 -0
  22. package/fn/date/index.js +1 -0
  23. package/fn/date/to-primitive.js +5 -0
  24. package/fn/object/define-getter.js +2 -0
  25. package/fn/object/define-setter.js +2 -0
  26. package/fn/object/index.js +4 -0
  27. package/fn/object/lookup-getter.js +2 -0
  28. package/fn/object/lookup-setter.js +2 -0
  29. package/fn/string/index.js +1 -0
  30. package/fn/string/match-all.js +2 -0
  31. package/fn/string/virtual/index.js +1 -0
  32. package/fn/string/virtual/match-all.js +2 -0
  33. package/fn/symbol/async-iterator.js +2 -0
  34. package/fn/symbol/has-instance.js +2 -1
  35. package/fn/symbol/index.js +2 -0
  36. package/fn/symbol/is-concat-spreadable.js +1 -1
  37. package/fn/symbol/iterator.js +1 -1
  38. package/fn/symbol/match.js +1 -1
  39. package/fn/symbol/observable.js +2 -0
  40. package/fn/symbol/replace.js +1 -1
  41. package/fn/symbol/search.js +1 -1
  42. package/fn/symbol/species.js +1 -1
  43. package/fn/symbol/split.js +1 -1
  44. package/fn/symbol/to-primitive.js +1 -1
  45. package/fn/symbol/to-string-tag.js +1 -1
  46. package/fn/symbol/unscopables.js +1 -1
  47. package/library/es6/date.js +1 -0
  48. package/library/es6/index.js +3 -2
  49. package/library/es7/asap.js +2 -0
  50. package/library/es7/index.js +8 -0
  51. package/library/es7/object.js +4 -0
  52. package/library/es7/string.js +1 -0
  53. package/library/es7/symbol.js +3 -0
  54. package/library/fn/asap.js +2 -0
  55. package/library/fn/date/index.js +1 -0
  56. package/library/fn/date/to-primitive.js +5 -0
  57. package/library/fn/object/define-getter.js +2 -0
  58. package/library/fn/object/define-setter.js +2 -0
  59. package/library/fn/object/index.js +4 -0
  60. package/library/fn/object/lookup-getter.js +2 -0
  61. package/library/fn/object/lookup-setter.js +2 -0
  62. package/library/fn/string/index.js +1 -0
  63. package/library/fn/string/match-all.js +2 -0
  64. package/library/fn/string/virtual/index.js +1 -0
  65. package/library/fn/string/virtual/match-all.js +2 -0
  66. package/library/fn/symbol/async-iterator.js +2 -0
  67. package/library/fn/symbol/has-instance.js +2 -1
  68. package/library/fn/symbol/index.js +2 -0
  69. package/library/fn/symbol/is-concat-spreadable.js +1 -1
  70. package/library/fn/symbol/iterator.js +1 -1
  71. package/library/fn/symbol/match.js +1 -1
  72. package/library/fn/symbol/observable.js +2 -0
  73. package/library/fn/symbol/replace.js +1 -1
  74. package/library/fn/symbol/search.js +1 -1
  75. package/library/fn/symbol/species.js +1 -1
  76. package/library/fn/symbol/split.js +1 -1
  77. package/library/fn/symbol/to-primitive.js +1 -1
  78. package/library/fn/symbol/to-string-tag.js +1 -1
  79. package/library/fn/symbol/unscopables.js +1 -1
  80. package/library/modules/_array-includes.js +1 -1
  81. package/library/modules/_array-species-constructor.js +16 -0
  82. package/library/modules/_array-species-create.js +3 -13
  83. package/library/modules/_core.js +1 -1
  84. package/library/modules/_create-property.js +8 -0
  85. package/library/modules/_date-to-primitive.js +9 -0
  86. package/library/modules/_iter-detect.js +1 -1
  87. package/library/modules/_math-expm1.js +8 -2
  88. package/library/modules/_microtask.js +58 -48
  89. package/library/modules/{_object-ipam.js → _object-forced-pam.js} +2 -2
  90. package/library/modules/_object-gopn-ext.js +2 -2
  91. package/library/modules/_string-pad.js +1 -2
  92. package/library/modules/_typed-array.js +11 -5
  93. package/library/modules/_wks-define.js +9 -0
  94. package/library/modules/_wks-ext.js +1 -0
  95. package/library/modules/_wks.js +5 -2
  96. package/library/modules/es6.array.filter.js +9 -9
  97. package/library/modules/es6.array.from.js +11 -9
  98. package/library/modules/es6.array.index-of.js +9 -4
  99. package/library/modules/es6.array.last-index-of.js +10 -6
  100. package/library/modules/es6.array.of.js +3 -2
  101. package/library/modules/es6.math.acosh.js +6 -2
  102. package/library/modules/es6.math.asinh.js +4 -2
  103. package/library/modules/es6.math.atanh.js +4 -2
  104. package/library/modules/es6.math.expm1.js +3 -2
  105. package/library/modules/es6.promise.js +1 -1
  106. package/library/modules/es6.symbol.js +58 -63
  107. package/library/modules/es7.array.includes.js +1 -1
  108. package/library/modules/es7.asap.js +12 -0
  109. package/library/modules/es7.object.define-getter.js +1 -1
  110. package/library/modules/es7.object.define-setter.js +1 -1
  111. package/library/modules/es7.object.entries.js +1 -1
  112. package/library/modules/es7.object.get-own-property-descriptors.js +8 -12
  113. package/library/modules/es7.object.lookup-getter.js +1 -1
  114. package/library/modules/es7.object.lookup-setter.js +1 -1
  115. package/library/modules/es7.object.values.js +1 -1
  116. package/library/modules/es7.string.match-all.js +7 -8
  117. package/library/modules/es7.string.pad-end.js +1 -0
  118. package/library/modules/es7.string.pad-start.js +1 -0
  119. package/library/modules/es7.symbol.async-iterator.js +1 -0
  120. package/library/modules/es7.symbol.observable.js +1 -0
  121. package/library/shim.js +11 -2
  122. package/library/stage/0.js +1 -0
  123. package/library/stage/1.js +3 -2
  124. package/library/stage/2.js +3 -1
  125. package/library/stage/3.js +1 -3
  126. package/library/stage/4.js +7 -1
  127. package/modules/_array-includes.js +1 -1
  128. package/modules/_array-species-constructor.js +16 -0
  129. package/modules/_array-species-create.js +3 -13
  130. package/modules/_core.js +1 -1
  131. package/modules/_create-property.js +8 -0
  132. package/modules/_date-to-primitive.js +9 -0
  133. package/modules/_iter-detect.js +1 -1
  134. package/modules/_math-expm1.js +8 -2
  135. package/modules/_microtask.js +58 -48
  136. package/modules/{_object-ipam.js → _object-forced-pam.js} +2 -2
  137. package/modules/_object-gopn-ext.js +2 -2
  138. package/modules/_string-pad.js +1 -2
  139. package/modules/_typed-array.js +11 -5
  140. package/modules/_wks-define.js +9 -0
  141. package/modules/_wks-ext.js +1 -0
  142. package/modules/_wks.js +5 -2
  143. package/modules/es6.array.filter.js +9 -9
  144. package/modules/es6.array.from.js +11 -9
  145. package/modules/es6.array.index-of.js +9 -4
  146. package/modules/es6.array.last-index-of.js +10 -6
  147. package/modules/es6.array.of.js +3 -2
  148. package/modules/es6.date.to-primitive.js +3 -11
  149. package/modules/es6.function.name.js +13 -4
  150. package/modules/es6.math.acosh.js +6 -2
  151. package/modules/es6.math.asinh.js +4 -2
  152. package/modules/es6.math.atanh.js +4 -2
  153. package/modules/es6.math.expm1.js +3 -2
  154. package/modules/es6.promise.js +1 -1
  155. package/modules/es6.symbol.js +58 -63
  156. package/modules/es7.array.includes.js +1 -1
  157. package/modules/es7.asap.js +12 -0
  158. package/modules/es7.object.define-getter.js +1 -1
  159. package/modules/es7.object.define-setter.js +1 -1
  160. package/modules/es7.object.entries.js +1 -1
  161. package/modules/es7.object.get-own-property-descriptors.js +8 -12
  162. package/modules/es7.object.lookup-getter.js +1 -1
  163. package/modules/es7.object.lookup-setter.js +1 -1
  164. package/modules/es7.object.values.js +1 -1
  165. package/modules/es7.string.match-all.js +7 -8
  166. package/modules/es7.string.pad-end.js +1 -0
  167. package/modules/es7.string.pad-start.js +1 -0
  168. package/modules/es7.symbol.async-iterator.js +1 -0
  169. package/modules/es7.symbol.observable.js +1 -0
  170. package/package.json +7 -7
  171. package/shim.js +11 -2
  172. package/stage/0.js +1 -0
  173. package/stage/1.js +3 -2
  174. package/stage/2.js +3 -1
  175. package/stage/3.js +1 -3
  176. package/stage/4.js +7 -1
@@ -3,56 +3,66 @@ var global = require('./_global')
3
3
  , Observer = global.MutationObserver || global.WebKitMutationObserver
4
4
  , process = global.process
5
5
  , Promise = global.Promise
6
- , isNode = require('./_cof')(process) == 'process'
7
- , head, last, notify;
6
+ , isNode = require('./_cof')(process) == 'process';
8
7
 
9
- var flush = function(){
10
- var parent, fn;
11
- if(isNode && (parent = process.domain))parent.exit();
12
- while(head){
13
- fn = head.fn;
14
- fn(); // <- currently we use it only for Promise - try / catch not required
15
- head = head.next;
16
- } last = undefined;
17
- if(parent)parent.enter();
18
- };
8
+ module.exports = function(){
9
+ var head, last, notify;
19
10
 
20
- // Node.js
21
- if(isNode){
22
- notify = function(){
23
- process.nextTick(flush);
11
+ var flush = function(){
12
+ var parent, fn;
13
+ if(isNode && (parent = process.domain))parent.exit();
14
+ while(head){
15
+ fn = head.fn;
16
+ head = head.next;
17
+ try {
18
+ fn();
19
+ } catch(e){
20
+ if(head)notify();
21
+ else last = undefined;
22
+ throw e;
23
+ }
24
+ } last = undefined;
25
+ if(parent)parent.enter();
24
26
  };
25
- // browsers with MutationObserver
26
- } else if(Observer){
27
- var toggle = true
28
- , node = document.createTextNode('');
29
- new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new
30
- notify = function(){
31
- node.data = toggle = !toggle;
32
- };
33
- // environments with maybe non-completely correct, but existent Promise
34
- } else if(Promise && Promise.resolve){
35
- notify = function(){
36
- Promise.resolve().then(flush);
37
- };
38
- // for other environments - macrotask based on:
39
- // - setImmediate
40
- // - MessageChannel
41
- // - window.postMessag
42
- // - onreadystatechange
43
- // - setTimeout
44
- } else {
45
- notify = function(){
46
- // strange IE + webpack dev server bug - use .call(global)
47
- macrotask.call(global, flush);
48
- };
49
- }
50
27
 
51
- module.exports = function(fn){
52
- var task = {fn: fn, next: undefined};
53
- if(last)last.next = task;
54
- if(!head){
55
- head = task;
56
- notify();
57
- } last = task;
28
+ // Node.js
29
+ if(isNode){
30
+ notify = function(){
31
+ process.nextTick(flush);
32
+ };
33
+ // browsers with MutationObserver
34
+ } else if(Observer){
35
+ var toggle = true
36
+ , node = document.createTextNode('');
37
+ new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new
38
+ notify = function(){
39
+ node.data = toggle = !toggle;
40
+ };
41
+ // environments with maybe non-completely correct, but existent Promise
42
+ } else if(Promise && Promise.resolve){
43
+ var promise = Promise.resolve();
44
+ notify = function(){
45
+ promise.then(flush);
46
+ };
47
+ // for other environments - macrotask based on:
48
+ // - setImmediate
49
+ // - MessageChannel
50
+ // - window.postMessag
51
+ // - onreadystatechange
52
+ // - setTimeout
53
+ } else {
54
+ notify = function(){
55
+ // strange IE + webpack dev server bug - use .call(global)
56
+ macrotask.call(global, flush);
57
+ };
58
+ }
59
+
60
+ return function(fn){
61
+ var task = {fn: fn, next: undefined};
62
+ if(last)last.next = task;
63
+ if(!head){
64
+ head = task;
65
+ notify();
66
+ } last = task;
67
+ };
58
68
  };
@@ -1,5 +1,5 @@
1
- // Incorrect prototype accessors methods
2
- module.exports = !require('./_fails')(function(){
1
+ // Forced replacement prototype accessors methods
2
+ module.exports = require('./_library')|| !require('./_fails')(function(){
3
3
  var K = Math.random();
4
4
  // In FF throws only define methods
5
5
  __defineSetter__.call(null, K, function(){ /* empty */});
@@ -8,7 +8,7 @@ var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNa
8
8
 
9
9
  var getWindowNames = function(it){
10
10
  try {
11
- return gOPN.f(it);
11
+ return gOPN(it);
12
12
  } catch(e){
13
13
  return windowNames.slice();
14
14
  }
@@ -16,4 +16,4 @@ var getWindowNames = function(it){
16
16
 
17
17
  module.exports.f = function getOwnPropertyNames(it){
18
18
  return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
19
- };
19
+ };
@@ -8,8 +8,7 @@ module.exports = function(that, maxLength, fillString, left){
8
8
  , stringLength = S.length
9
9
  , fillStr = fillString === undefined ? ' ' : String(fillString)
10
10
  , intMaxLength = toLength(maxLength);
11
- if(intMaxLength <= stringLength)return S;
12
- if(fillStr == '')fillStr = ' ';
11
+ if(intMaxLength <= stringLength || fillStr == '')return S;
13
12
  var fillLen = intMaxLength - stringLength
14
13
  , stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length));
15
14
  if(stringFiller.length > fillLen)stringFiller = stringFiller.slice(0, fillLen);
@@ -223,9 +223,6 @@ if(require('./_descriptors')){
223
223
  that[length] = value;
224
224
  } return that;
225
225
  },
226
- slice: function slice(start, end){
227
- return speciesFromList(this, arraySlice.call(validate(this), start, end));
228
- },
229
226
  some: function some(callbackfn /*, thisArg */){
230
227
  return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
231
228
  },
@@ -244,6 +241,10 @@ if(require('./_descriptors')){
244
241
  }
245
242
  };
246
243
 
244
+ var $slice = function slice(start, end){
245
+ return speciesFromList(this, arraySlice.call(validate(this), start, end));
246
+ };
247
+
247
248
  var $set = function set(arrayLike /*, offset */){
248
249
  validate(this);
249
250
  var offset = toOffset(arguments[1], 1)
@@ -315,6 +316,7 @@ if(require('./_descriptors')){
315
316
  redefineAll($TypedArrayPrototype$, $iterators);
316
317
  hide($TypedArrayPrototype$, ITERATOR, $iterators.values);
317
318
  redefineAll($TypedArrayPrototype$, {
319
+ slice: $slice,
318
320
  set: $set,
319
321
  constructor: function(){ /* noop */ },
320
322
  toString: arrayToString,
@@ -455,12 +457,18 @@ if(require('./_descriptors')){
455
457
 
456
458
  $export($export.P, NAME, proto);
457
459
 
460
+ setSpecies(NAME);
461
+
458
462
  $export($export.P + $export.F * FORCED_SET, NAME, {set: $set});
459
463
 
460
464
  $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators);
461
465
 
462
466
  $export($export.P + $export.F * (TypedArrayPrototype.toString != arrayToString), NAME, {toString: arrayToString});
463
467
 
468
+ $export($export.P + $export.F * fails(function(){
469
+ new TypedArray(1).slice();
470
+ }), NAME, {slice: $slice});
471
+
464
472
  $export($export.P + $export.F * (fails(function(){
465
473
  return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString()
466
474
  }) || !fails(function(){
@@ -469,7 +477,5 @@ if(require('./_descriptors')){
469
477
 
470
478
  Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator;
471
479
  if(!LIBRARY && !CORRECT_ITER_NAME)hide(TypedArrayPrototype, ITERATOR, $iterator);
472
-
473
- setSpecies(NAME);
474
480
  };
475
481
  } else module.exports = function(){ /* empty */ };
@@ -0,0 +1,9 @@
1
+ var global = require('./_global')
2
+ , core = require('./_core')
3
+ , LIBRARY = require('./_library')
4
+ , wksExt = require('./_wks-ext')
5
+ , defineProperty = require('./_object-dp').f;
6
+ module.exports = function(name){
7
+ var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
8
+ if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)});
9
+ };
@@ -0,0 +1 @@
1
+ exports.f = require('./_wks');
@@ -2,7 +2,10 @@ var store = require('./_shared')('wks')
2
2
  , uid = require('./_uid')
3
3
  , Symbol = require('./_global').Symbol
4
4
  , USE_SYMBOL = typeof Symbol == 'function';
5
- module.exports = function(name){
5
+
6
+ var $exports = module.exports = function(name){
6
7
  return store[name] || (store[name] =
7
8
  USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
8
- };
9
+ };
10
+
11
+ $exports.store = store;
@@ -1,10 +1,10 @@
1
- 'use strict';
2
- var $export = require('./_export')
3
- , $filter = require('./_array-methods')(2);
4
-
5
- $export($export.P + $export.F * !require('./_strict-method')([].filter, true), 'Array', {
6
- // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
7
- filter: function filter(callbackfn /* , thisArg */){
8
- return $filter(this, callbackfn, arguments[1]);
9
- }
1
+ 'use strict';
2
+ var $export = require('./_export')
3
+ , $filter = require('./_array-methods')(2);
4
+
5
+ $export($export.P + $export.F * !require('./_strict-method')([].filter, true), 'Array', {
6
+ // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
7
+ filter: function filter(callbackfn /* , thisArg */){
8
+ return $filter(this, callbackfn, arguments[1]);
9
+ }
10
10
  });
@@ -1,11 +1,13 @@
1
1
  'use strict';
2
- var ctx = require('./_ctx')
3
- , $export = require('./_export')
4
- , toObject = require('./_to-object')
5
- , call = require('./_iter-call')
6
- , isArrayIter = require('./_is-array-iter')
7
- , toLength = require('./_to-length')
8
- , getIterFn = require('./core.get-iterator-method');
2
+ var ctx = require('./_ctx')
3
+ , $export = require('./_export')
4
+ , toObject = require('./_to-object')
5
+ , call = require('./_iter-call')
6
+ , isArrayIter = require('./_is-array-iter')
7
+ , toLength = require('./_to-length')
8
+ , createProperty = require('./_create-property')
9
+ , getIterFn = require('./core.get-iterator-method');
10
+
9
11
  $export($export.S + $export.F * !require('./_iter-detect')(function(iter){ Array.from(iter); }), 'Array', {
10
12
  // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
11
13
  from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){
@@ -21,12 +23,12 @@ $export($export.S + $export.F * !require('./_iter-detect')(function(iter){ Array
21
23
  // if object isn't iterable or it's array with default iterator - use simple case
22
24
  if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){
23
25
  for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){
24
- result[index] = mapping ? call(iterator, mapfn, [step.value, index], true) : step.value;
26
+ createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
25
27
  }
26
28
  } else {
27
29
  length = toLength(O.length);
28
30
  for(result = new C(length); length > index; index++){
29
- result[index] = mapping ? mapfn(O[index], index) : O[index];
31
+ createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
30
32
  }
31
33
  }
32
34
  result.length = index;
@@ -1,10 +1,15 @@
1
1
  'use strict';
2
- var $export = require('./_export')
3
- , $indexOf = require('./_array-includes')(false);
2
+ var $export = require('./_export')
3
+ , $indexOf = require('./_array-includes')(false)
4
+ , $native = [].indexOf
5
+ , NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0;
4
6
 
5
- $export($export.P + $export.F * !require('./_strict-method')([].indexOf), 'Array', {
7
+ $export($export.P + $export.F * (NEGATIVE_ZERO || !require('./_strict-method')($native)), 'Array', {
6
8
  // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
7
9
  indexOf: function indexOf(searchElement /*, fromIndex = 0 */){
8
- return $indexOf(this, searchElement, arguments[1]);
10
+ return NEGATIVE_ZERO
11
+ // convert -0 to +0
12
+ ? $native.apply(this, arguments) || 0
13
+ : $indexOf(this, searchElement, arguments[1]);
9
14
  }
10
15
  });
@@ -1,18 +1,22 @@
1
1
  'use strict';
2
- var $export = require('./_export')
3
- , toIObject = require('./_to-iobject')
4
- , toInteger = require('./_to-integer')
5
- , toLength = require('./_to-length');
2
+ var $export = require('./_export')
3
+ , toIObject = require('./_to-iobject')
4
+ , toInteger = require('./_to-integer')
5
+ , toLength = require('./_to-length')
6
+ , $native = [].lastIndexOf
7
+ , NEGATIVE_ZERO = !!$native && 1 / [1].lastIndexOf(1, -0) < 0;
6
8
 
7
- $export($export.P + $export.F * !require('./_strict-method')([].lastIndexOf), 'Array', {
9
+ $export($export.P + $export.F * (NEGATIVE_ZERO || !require('./_strict-method')($native)), 'Array', {
8
10
  // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex])
9
11
  lastIndexOf: function lastIndexOf(searchElement /*, fromIndex = @[*-1] */){
12
+ // convert -0 to +0
13
+ if(NEGATIVE_ZERO)return $native.apply(this, arguments) || 0;
10
14
  var O = toIObject(this)
11
15
  , length = toLength(O.length)
12
16
  , index = length - 1;
13
17
  if(arguments.length > 1)index = Math.min(index, toInteger(arguments[1]));
14
18
  if(index < 0)index = length + index;
15
- for(;index >= 0; index--)if(index in O)if(O[index] === searchElement)return index;
19
+ for(;index >= 0; index--)if(index in O)if(O[index] === searchElement)return index || 0;
16
20
  return -1;
17
21
  }
18
22
  });
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
- var $export = require('./_export');
2
+ var $export = require('./_export')
3
+ , createProperty = require('./_create-property');
3
4
 
4
5
  // WebKit Array.of isn't generic
5
6
  $export($export.S + $export.F * require('./_fails')(function(){
@@ -11,7 +12,7 @@ $export($export.S + $export.F * require('./_fails')(function(){
11
12
  var index = 0
12
13
  , aLen = arguments.length
13
14
  , result = new (typeof this == 'function' ? this : Array)(aLen);
14
- while(aLen > index)result[index] = arguments[index++];
15
+ while(aLen > index)createProperty(result, index, arguments[index++]);
15
16
  result.length = aLen;
16
17
  return result;
17
18
  }
@@ -4,8 +4,12 @@ var $export = require('./_export')
4
4
  , sqrt = Math.sqrt
5
5
  , $acosh = Math.acosh;
6
6
 
7
- // V8 bug https://code.google.com/p/v8/issues/detail?id=3509
8
- $export($export.S + $export.F * !($acosh && Math.floor($acosh(Number.MAX_VALUE)) == 710), 'Math', {
7
+ $export($export.S + $export.F * !($acosh
8
+ // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509
9
+ && Math.floor($acosh(Number.MAX_VALUE)) == 710
10
+ // Tor Browser bug: Math.acosh(Infinity) -> NaN
11
+ && $acosh(Infinity) == Infinity
12
+ ), 'Math', {
9
13
  acosh: function acosh(x){
10
14
  return (x = +x) < 1 ? NaN : x > 94906265.62425156
11
15
  ? Math.log(x) + Math.LN2
@@ -1,8 +1,10 @@
1
1
  // 20.2.2.5 Math.asinh(x)
2
- var $export = require('./_export');
2
+ var $export = require('./_export')
3
+ , $asinh = Math.asinh;
3
4
 
4
5
  function asinh(x){
5
6
  return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1));
6
7
  }
7
8
 
8
- $export($export.S, 'Math', {asinh: asinh});
9
+ // Tor Browser bug: Math.asinh(0) -> -0
10
+ $export($export.S + $export.F * !($asinh && 1 / $asinh(0) > 0), 'Math', {asinh: asinh});
@@ -1,7 +1,9 @@
1
1
  // 20.2.2.7 Math.atanh(x)
2
- var $export = require('./_export');
2
+ var $export = require('./_export')
3
+ , $atanh = Math.atanh;
3
4
 
4
- $export($export.S, 'Math', {
5
+ // Tor Browser bug: Math.atanh(-0) -> 0
6
+ $export($export.S + $export.F * !($atanh && 1 / $atanh(-0) < 0), 'Math', {
5
7
  atanh: function atanh(x){
6
8
  return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2;
7
9
  }
@@ -1,4 +1,5 @@
1
1
  // 20.2.2.14 Math.expm1(x)
2
- var $export = require('./_export');
2
+ var $export = require('./_export')
3
+ , $expm1 = require('./_math-expm1');
3
4
 
4
- $export($export.S, 'Math', {expm1: require('./_math-expm1')});
5
+ $export($export.S + $export.F * ($expm1 != Math.expm1), 'Math', {expm1: $expm1});
@@ -12,7 +12,7 @@ var LIBRARY = require('./_library')
12
12
  , setProto = require('./_set-proto').set
13
13
  , speciesConstructor = require('./_species-constructor')
14
14
  , task = require('./_task').set
15
- , microtask = require('./_microtask')
15
+ , microtask = require('./_microtask')()
16
16
  , PROMISE = 'Promise'
17
17
  , TypeError = global.TypeError
18
18
  , process = global.process
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
  // ECMAScript 6 symbols shim
3
3
  var global = require('./_global')
4
- , core = require('./_core')
5
4
  , has = require('./_has')
6
5
  , DESCRIPTORS = require('./_descriptors')
7
6
  , $export = require('./_export')
@@ -12,6 +11,8 @@ var global = require('./_global')
12
11
  , setToStringTag = require('./_set-to-string-tag')
13
12
  , uid = require('./_uid')
14
13
  , wks = require('./_wks')
14
+ , wksExt = require('./_wks-ext')
15
+ , wksDefine = require('./_wks-define')
15
16
  , keyOf = require('./_keyof')
16
17
  , enumKeys = require('./_enum-keys')
17
18
  , isArray = require('./_is-array')
@@ -23,20 +24,24 @@ var global = require('./_global')
23
24
  , gOPNExt = require('./_object-gopn-ext')
24
25
  , $GOPD = require('./_object-gopd')
25
26
  , $DP = require('./_object-dp')
27
+ , $keys = require('./_object-keys')
26
28
  , gOPD = $GOPD.f
27
29
  , dP = $DP.f
28
30
  , gOPN = gOPNExt.f
29
31
  , $Symbol = global.Symbol
30
32
  , $JSON = global.JSON
31
33
  , _stringify = $JSON && $JSON.stringify
32
- , setter = false
34
+ , PROTOTYPE = 'prototype'
33
35
  , HIDDEN = wks('_hidden')
36
+ , TO_PRIMITIVE = wks('toPrimitive')
34
37
  , isEnum = {}.propertyIsEnumerable
35
38
  , SymbolRegistry = shared('symbol-registry')
36
39
  , AllSymbols = shared('symbols')
37
- , ObjectProto = Object.prototype
40
+ , ObjectProto = Object[PROTOTYPE]
38
41
  , USE_NATIVE = typeof $Symbol == 'function'
39
42
  , QObject = global.QObject;
43
+ // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
44
+ var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
40
45
 
41
46
  // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
42
47
  var setSymbolDesc = DESCRIPTORS && $fails(function(){
@@ -51,20 +56,15 @@ var setSymbolDesc = DESCRIPTORS && $fails(function(){
51
56
  } : dP;
52
57
 
53
58
  var wrap = function(tag){
54
- var sym = AllSymbols[tag] = _create($Symbol.prototype);
59
+ var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
55
60
  sym._k = tag;
56
- DESCRIPTORS && setter && setSymbolDesc(ObjectProto, tag, {
57
- configurable: true,
58
- set: function(value){
59
- if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
60
- setSymbolDesc(this, tag, createDesc(1, value));
61
- }
62
- });
63
61
  return sym;
64
62
  };
65
63
 
66
- var isSymbol = function(it){
64
+ var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){
67
65
  return typeof it == 'symbol';
66
+ } : function(it){
67
+ return it instanceof $Symbol;
68
68
  };
69
69
 
70
70
  var $defineProperty = function defineProperty(it, key, D){
@@ -118,78 +118,48 @@ var $getOwnPropertySymbols = function getOwnPropertySymbols(it){
118
118
  while(names.length > i)if(has(AllSymbols, key = names[i++]))result.push(AllSymbols[key]);
119
119
  return result;
120
120
  };
121
- var $stringify = function stringify(it){
122
- if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined
123
- var args = [it]
124
- , i = 1
125
- , replacer, $replacer;
126
- while(arguments.length > i)args.push(arguments[i++]);
127
- replacer = args[1];
128
- if(typeof replacer == 'function')$replacer = replacer;
129
- if($replacer || !isArray(replacer))replacer = function(key, value){
130
- if($replacer)value = $replacer.call(this, key, value);
131
- if(!isSymbol(value))return value;
132
- };
133
- args[1] = replacer;
134
- return _stringify.apply($JSON, args);
135
- };
136
- var BUGGY_JSON = $fails(function(){
137
- var S = $Symbol();
138
- // MS Edge converts symbol values to JSON as {}
139
- // WebKit converts symbol values to JSON as null
140
- // V8 throws on boxed symbols
141
- return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}';
142
- });
143
121
 
144
122
  // 19.4.1.1 Symbol([description])
145
123
  if(!USE_NATIVE){
146
124
  $Symbol = function Symbol(){
147
- if(isSymbol(this))throw TypeError('Symbol is not a constructor');
148
- return wrap(uid(arguments.length > 0 ? arguments[0] : undefined));
125
+ if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!');
126
+ var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
127
+ DESCRIPTORS && setter && setSymbolDesc(ObjectProto, tag, {
128
+ configurable: true,
129
+ set: function(value){
130
+ if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
131
+ setSymbolDesc(this, tag, createDesc(1, value));
132
+ }
133
+ });
134
+ return wrap(tag);
149
135
  };
150
- redefine($Symbol.prototype, 'toString', function toString(){
136
+ redefine($Symbol[PROTOTYPE], 'toString', function toString(){
151
137
  return this._k;
152
138
  });
153
139
 
154
- isSymbol = function(it){
155
- return it instanceof $Symbol;
156
- };
157
-
158
140
  $GOPD.f = $getOwnPropertyDescriptor;
159
141
  $DP.f = $defineProperty;
160
142
  require('./_object-gopn').f = gOPNExt.f = $getOwnPropertyNames;
161
- require('./_object-pie').f = $propertyIsEnumerable
143
+ require('./_object-pie').f = $propertyIsEnumerable;
162
144
  require('./_object-gops').f = $getOwnPropertySymbols;
163
145
 
164
146
  if(DESCRIPTORS && !require('./_library')){
165
147
  redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
166
148
  }
149
+
150
+ wksExt.f = function(name){
151
+ return wrap(wks(name));
152
+ }
167
153
  }
168
154
 
169
155
  $export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol});
170
156
 
171
- // 19.4.2.2 Symbol.hasInstance
172
- // 19.4.2.3 Symbol.isConcatSpreadable
173
- // 19.4.2.4 Symbol.iterator
174
- // 19.4.2.6 Symbol.match
175
- // 19.4.2.8 Symbol.replace
176
- // 19.4.2.9 Symbol.search
177
- // 19.4.2.10 Symbol.species
178
- // 19.4.2.11 Symbol.split
179
- // 19.4.2.12 Symbol.toPrimitive
180
- // 19.4.2.13 Symbol.toStringTag
181
- // 19.4.2.14 Symbol.unscopables
182
157
  for(var symbols = (
158
+ // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
183
159
  'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
184
- ).split(','), i = 0; symbols.length > i; ){
185
- var key = symbols[i++]
186
- , Wrapper = core.Symbol
187
- , sym = wks(key);
188
- if(!(key in Wrapper))dP(Wrapper, key, {value: USE_NATIVE ? sym : wrap(sym)});
189
- };
160
+ ).split(','), i = 0; symbols.length > i; )wks(symbols[i++]);
190
161
 
191
- // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
192
- if(!QObject || !QObject.prototype || !QObject.prototype.findChild)setter = true;
162
+ for(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]);
193
163
 
194
164
  $export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
195
165
  // 19.4.2.1 Symbol.for(key)
@@ -200,7 +170,8 @@ $export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
200
170
  },
201
171
  // 19.4.2.5 Symbol.keyFor(sym)
202
172
  keyFor: function keyFor(key){
203
- return keyOf(SymbolRegistry, key);
173
+ if(isSymbol(key))return keyOf(SymbolRegistry, key);
174
+ throw TypeError(key + ' is not a symbol!');
204
175
  },
205
176
  useSetter: function(){ setter = true; },
206
177
  useSimple: function(){ setter = false; }
@@ -222,8 +193,32 @@ $export($export.S + $export.F * !USE_NATIVE, 'Object', {
222
193
  });
223
194
 
224
195
  // 24.3.2 JSON.stringify(value [, replacer [, space]])
225
- $JSON && $export($export.S + $export.F * (!USE_NATIVE || BUGGY_JSON), 'JSON', {stringify: $stringify});
196
+ $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){
197
+ var S = $Symbol();
198
+ // MS Edge converts symbol values to JSON as {}
199
+ // WebKit converts symbol values to JSON as null
200
+ // V8 throws on boxed symbols
201
+ return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}';
202
+ })), 'JSON', {
203
+ stringify: function stringify(it){
204
+ if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined
205
+ var args = [it]
206
+ , i = 1
207
+ , replacer, $replacer;
208
+ while(arguments.length > i)args.push(arguments[i++]);
209
+ replacer = args[1];
210
+ if(typeof replacer == 'function')$replacer = replacer;
211
+ if($replacer || !isArray(replacer))replacer = function(key, value){
212
+ if($replacer)value = $replacer.call(this, key, value);
213
+ if(!isSymbol(value))return value;
214
+ };
215
+ args[1] = replacer;
216
+ return _stringify.apply($JSON, args);
217
+ }
218
+ });
226
219
 
220
+ // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
221
+ $Symbol[PROTOTYPE][TO_PRIMITIVE] || require('./_hide')($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
227
222
  // 19.4.3.5 Symbol.prototype[@@toStringTag]
228
223
  setToStringTag($Symbol, 'Symbol');
229
224
  // 20.2.1.9 Math[@@toStringTag]
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
+ // https://github.com/tc39/Array.prototype.includes
2
3
  var $export = require('./_export')
3
4
  , $includes = require('./_array-includes')(true);
4
5
 
5
6
  $export($export.P, 'Array', {
6
- // https://github.com/domenic/Array.prototype.includes
7
7
  includes: function includes(el /*, fromIndex = 0 */){
8
8
  return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
9
9
  }
@@ -0,0 +1,12 @@
1
+ // https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask
2
+ var $export = require('./_export')
3
+ , microtask = require('./_microtask')()
4
+ , process = require('./_global').process
5
+ , isNode = require('./_cof')(process) == 'process';
6
+
7
+ $export($export.G, {
8
+ asap: function asap(fn){
9
+ var domain = isNode && process.domain;
10
+ microtask(domain ? domain.bind(fn) : fn);
11
+ }
12
+ });