core-js 2.5.0 → 2.5.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 (60) hide show
  1. package/CHANGELOG.md +24 -1
  2. package/LICENSE +1 -1
  3. package/README.md +74 -74
  4. package/bower.json +8 -6
  5. package/build/build.ls +2 -2
  6. package/build/index.js +1 -1
  7. package/client/core.js +390 -386
  8. package/client/core.min.js +5 -5
  9. package/client/core.min.js.map +1 -1
  10. package/client/library.js +309 -304
  11. package/client/library.min.js +5 -5
  12. package/client/library.min.js.map +1 -1
  13. package/client/shim.js +456 -507
  14. package/client/shim.min.js +5 -5
  15. package/client/shim.min.js.map +1 -1
  16. package/fn/array/virtual/iterator.js +1 -1
  17. package/fn/array/virtual/values.js +1 -1
  18. package/fn/number/parse-float.js +1 -1
  19. package/fn/number/parse-int.js +1 -1
  20. package/fn/string/virtual/iterator.js +1 -1
  21. package/library/fn/array/virtual/iterator.js +1 -1
  22. package/library/fn/array/virtual/values.js +1 -1
  23. package/library/fn/number/parse-float.js +1 -1
  24. package/library/fn/number/parse-int.js +1 -1
  25. package/library/fn/string/virtual/iterator.js +1 -1
  26. package/library/modules/_core.js +1 -1
  27. package/library/modules/_export.js +2 -1
  28. package/library/modules/_iter-define.js +1 -2
  29. package/library/modules/_microtask.js +2 -2
  30. package/library/modules/_partial.js +1 -1
  31. package/library/modules/_promise-resolve.js +4 -0
  32. package/library/modules/_set-collection-of.js +1 -1
  33. package/library/modules/_typed-buffer.js +2 -2
  34. package/library/modules/_user-agent.js +4 -0
  35. package/library/modules/es6.array.slice.js +1 -1
  36. package/library/modules/es6.promise.js +10 -21
  37. package/library/modules/es6.symbol.js +8 -9
  38. package/library/modules/es7.observable.js +1 -1
  39. package/library/modules/es7.string.pad-end.js +3 -1
  40. package/library/modules/es7.string.pad-start.js +3 -1
  41. package/library/modules/web.timers.js +10 -11
  42. package/library/stage/2.js +1 -1
  43. package/modules/_core.js +1 -1
  44. package/modules/_iter-define.js +1 -2
  45. package/modules/_microtask.js +2 -2
  46. package/modules/_partial.js +1 -1
  47. package/modules/_promise-resolve.js +4 -0
  48. package/modules/_set-collection-of.js +1 -1
  49. package/modules/_typed-buffer.js +2 -2
  50. package/modules/_user-agent.js +4 -0
  51. package/modules/es6.array.slice.js +1 -1
  52. package/modules/es6.promise.js +10 -21
  53. package/modules/es6.symbol.js +8 -9
  54. package/modules/es7.observable.js +1 -1
  55. package/modules/es7.string.pad-end.js +3 -1
  56. package/modules/es7.string.pad-start.js +3 -1
  57. package/modules/library/_export.js +2 -1
  58. package/modules/web.timers.js +10 -11
  59. package/package.json +28 -26
  60. package/stage/2.js +1 -1
@@ -1,2 +1,2 @@
1
- require('../../../modules/core.number.iterator');
1
+ require('../../../modules/es6.array.iterator');
2
2
  module.exports = require('../../../modules/_iterators').Array;
@@ -1,2 +1,2 @@
1
- require('../../../modules/core.number.iterator');
1
+ require('../../../modules/es6.array.iterator');
2
2
  module.exports = require('../../../modules/_iterators').Array;
@@ -1,2 +1,2 @@
1
1
  require('../../modules/es6.number.parse-float');
2
- module.exports = parseFloat;
2
+ module.exports = require('../../modules/_core').Number.parseFloat;
@@ -1,2 +1,2 @@
1
1
  require('../../modules/es6.number.parse-int');
2
- module.exports = parseInt;
2
+ module.exports = require('../../modules/_core').Number.parseInt;
@@ -1,2 +1,2 @@
1
- require('../../../modules/core.number.iterator');
1
+ require('../../../modules/es6.string.iterator');
2
2
  module.exports = require('../../../modules/_iterators').String;
@@ -1,2 +1,2 @@
1
- require('../../../modules/core.number.iterator');
1
+ require('../../../modules/es6.array.iterator');
2
2
  module.exports = require('../../../modules/_iterators').Array;
@@ -1,2 +1,2 @@
1
- require('../../../modules/core.number.iterator');
1
+ require('../../../modules/es6.array.iterator');
2
2
  module.exports = require('../../../modules/_iterators').Array;
@@ -1,2 +1,2 @@
1
1
  require('../../modules/es6.number.parse-float');
2
- module.exports = parseFloat;
2
+ module.exports = require('../../modules/_core').Number.parseFloat;
@@ -1,2 +1,2 @@
1
1
  require('../../modules/es6.number.parse-int');
2
- module.exports = parseInt;
2
+ module.exports = require('../../modules/_core').Number.parseInt;
@@ -1,2 +1,2 @@
1
- require('../../../modules/core.number.iterator');
1
+ require('../../../modules/es6.string.iterator');
2
2
  module.exports = require('../../../modules/_iterators').String;
@@ -1,2 +1,2 @@
1
- var core = module.exports = { version: '2.5.0' };
1
+ var core = module.exports = { version: '2.5.4' };
2
2
  if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
@@ -2,6 +2,7 @@ var global = require('./_global');
2
2
  var core = require('./_core');
3
3
  var ctx = require('./_ctx');
4
4
  var hide = require('./_hide');
5
+ var has = require('./_has');
5
6
  var PROTOTYPE = 'prototype';
6
7
 
7
8
  var $export = function (type, name, source) {
@@ -19,7 +20,7 @@ var $export = function (type, name, source) {
19
20
  for (key in source) {
20
21
  // contains in native
21
22
  own = !IS_FORCED && target && target[key] !== undefined;
22
- if (own && key in exports) continue;
23
+ if (own && has(exports, key)) continue;
23
24
  // export native or passed
24
25
  out = own ? target[key] : source[key];
25
26
  // prevent global pollution for namespaces
@@ -3,7 +3,6 @@ var LIBRARY = require('./_library');
3
3
  var $export = require('./_export');
4
4
  var redefine = require('./_redefine');
5
5
  var hide = require('./_hide');
6
- var has = require('./_has');
7
6
  var Iterators = require('./_iterators');
8
7
  var $iterCreate = require('./_iter-create');
9
8
  var setToStringTag = require('./_set-to-string-tag');
@@ -41,7 +40,7 @@ module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCE
41
40
  // Set @@toStringTag to native iterators
42
41
  setToStringTag(IteratorPrototype, TAG, true);
43
42
  // fix for some old engines
44
- if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
43
+ if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
45
44
  }
46
45
  }
47
46
  // fix Array#{values, @@iterator}.name in V8 / FF
@@ -30,8 +30,8 @@ module.exports = function () {
30
30
  notify = function () {
31
31
  process.nextTick(flush);
32
32
  };
33
- // browsers with MutationObserver
34
- } else if (Observer) {
33
+ // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
34
+ } else if (Observer && !(global.navigator && global.navigator.standalone)) {
35
35
  var toggle = true;
36
36
  var node = document.createTextNode('');
37
37
  new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
@@ -5,7 +5,7 @@ var aFunction = require('./_a-function');
5
5
  module.exports = function (/* ...pargs */) {
6
6
  var fn = aFunction(this);
7
7
  var length = arguments.length;
8
- var pargs = Array(length);
8
+ var pargs = new Array(length);
9
9
  var i = 0;
10
10
  var _ = path._;
11
11
  var holder = false;
@@ -1,6 +1,10 @@
1
+ var anObject = require('./_an-object');
2
+ var isObject = require('./_is-object');
1
3
  var newPromiseCapability = require('./_new-promise-capability');
2
4
 
3
5
  module.exports = function (C, x) {
6
+ anObject(C);
7
+ if (isObject(x) && x.constructor === C) return x;
4
8
  var promiseCapability = newPromiseCapability.f(C);
5
9
  var resolve = promiseCapability.resolve;
6
10
  resolve(x);
@@ -5,7 +5,7 @@ var $export = require('./_export');
5
5
  module.exports = function (COLLECTION) {
6
6
  $export($export.S, COLLECTION, { of: function of() {
7
7
  var length = arguments.length;
8
- var A = Array(length);
8
+ var A = new Array(length);
9
9
  while (length--) A[length] = arguments[length];
10
10
  return new this(A);
11
11
  } });
@@ -40,7 +40,7 @@ var $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET;
40
40
 
41
41
  // IEEE754 conversions based on https://github.com/feross/ieee754
42
42
  function packIEEE754(value, mLen, nBytes) {
43
- var buffer = Array(nBytes);
43
+ var buffer = new Array(nBytes);
44
44
  var eLen = nBytes * 8 - mLen - 1;
45
45
  var eMax = (1 << eLen) - 1;
46
46
  var eBias = eMax >> 1;
@@ -158,7 +158,7 @@ if (!$typed.ABV) {
158
158
  $ArrayBuffer = function ArrayBuffer(length) {
159
159
  anInstance(this, $ArrayBuffer, ARRAY_BUFFER);
160
160
  var byteLength = toIndex(length);
161
- this._b = arrayFill.call(Array(byteLength), 0);
161
+ this._b = arrayFill.call(new Array(byteLength), 0);
162
162
  this[$LENGTH] = byteLength;
163
163
  };
164
164
 
@@ -0,0 +1,4 @@
1
+ var global = require('./_global');
2
+ var navigator = global.navigator;
3
+
4
+ module.exports = navigator && navigator.userAgent || '';
@@ -18,7 +18,7 @@ $export($export.P + $export.F * require('./_fails')(function () {
18
18
  var start = toAbsoluteIndex(begin, len);
19
19
  var upTo = toAbsoluteIndex(end, len);
20
20
  var size = toLength(upTo - start);
21
- var cloned = Array(size);
21
+ var cloned = new Array(size);
22
22
  var i = 0;
23
23
  for (; i < size; i++) cloned[i] = klass == 'String'
24
24
  ? this.charAt(start + i)
@@ -36,12 +36,6 @@ var USE_NATIVE = !!function () {
36
36
  }();
37
37
 
38
38
  // helpers
39
- var sameConstructor = LIBRARY ? function (a, b) {
40
- // with library wrapper special case
41
- return a === b || a === $Promise && b === Wrapper;
42
- } : function (a, b) {
43
- return a === b;
44
- };
45
39
  var isThenable = function (it) {
46
40
  var then;
47
41
  return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
@@ -59,7 +53,7 @@ var notify = function (promise, isReject) {
59
53
  var resolve = reaction.resolve;
60
54
  var reject = reaction.reject;
61
55
  var domain = reaction.domain;
62
- var result, then;
56
+ var result, then, exited;
63
57
  try {
64
58
  if (handler) {
65
59
  if (!ok) {
@@ -69,8 +63,11 @@ var notify = function (promise, isReject) {
69
63
  if (handler === true) result = value;
70
64
  else {
71
65
  if (domain) domain.enter();
72
- result = handler(value);
73
- if (domain) domain.exit();
66
+ result = handler(value); // may throw
67
+ if (domain) {
68
+ domain.exit();
69
+ exited = true;
70
+ }
74
71
  }
75
72
  if (result === reaction.promise) {
76
73
  reject(TypeError('Promise-chain cycle'));
@@ -79,6 +76,7 @@ var notify = function (promise, isReject) {
79
76
  } else resolve(result);
80
77
  } else reject(value);
81
78
  } catch (e) {
79
+ if (domain && !exited) domain.exit();
82
80
  reject(e);
83
81
  }
84
82
  };
@@ -110,14 +108,7 @@ var onUnhandled = function (promise) {
110
108
  });
111
109
  };
112
110
  var isUnhandled = function (promise) {
113
- if (promise._h == 1) return false;
114
- var chain = promise._a || promise._c;
115
- var i = 0;
116
- var reaction;
117
- while (chain.length > i) {
118
- reaction = chain[i++];
119
- if (reaction.fail || !isUnhandled(reaction.promise)) return false;
120
- } return true;
111
+ return promise._h !== 1 && (promise._a || promise._c).length === 0;
121
112
  };
122
113
  var onHandleUnhandled = function (promise) {
123
114
  task.call(global, function () {
@@ -213,7 +204,7 @@ if (!USE_NATIVE) {
213
204
  this.reject = ctx($reject, promise, 1);
214
205
  };
215
206
  newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
216
- return sameConstructor($Promise, C)
207
+ return C === $Promise || C === Wrapper
217
208
  ? new OwnPromiseCapability(C)
218
209
  : newGenericPromiseCapability(C);
219
210
  };
@@ -237,9 +228,7 @@ $export($export.S + $export.F * !USE_NATIVE, PROMISE, {
237
228
  $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
238
229
  // 25.4.4.6 Promise.resolve(x)
239
230
  resolve: function resolve(x) {
240
- // instanceof instead of internal slot check because we should fix it without replacement native Promise core
241
- if (x instanceof $Promise && sameConstructor(x.constructor, this)) return x;
242
- return promiseResolve(this, x);
231
+ return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);
243
232
  }
244
233
  });
245
234
  $export($export.S + $export.F * !(USE_NATIVE && require('./_iter-detect')(function (iter) {
@@ -13,10 +13,10 @@ var uid = require('./_uid');
13
13
  var wks = require('./_wks');
14
14
  var wksExt = require('./_wks-ext');
15
15
  var wksDefine = require('./_wks-define');
16
- var keyOf = require('./_keyof');
17
16
  var enumKeys = require('./_enum-keys');
18
17
  var isArray = require('./_is-array');
19
18
  var anObject = require('./_an-object');
19
+ var isObject = require('./_is-object');
20
20
  var toIObject = require('./_to-iobject');
21
21
  var toPrimitive = require('./_to-primitive');
22
22
  var createDesc = require('./_property-desc');
@@ -177,9 +177,9 @@ $export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
177
177
  : SymbolRegistry[key] = $Symbol(key);
178
178
  },
179
179
  // 19.4.2.5 Symbol.keyFor(sym)
180
- keyFor: function keyFor(key) {
181
- if (isSymbol(key)) return keyOf(SymbolRegistry, key);
182
- throw TypeError(key + ' is not a symbol!');
180
+ keyFor: function keyFor(sym) {
181
+ if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
182
+ for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
183
183
  },
184
184
  useSetter: function () { setter = true; },
185
185
  useSimple: function () { setter = false; }
@@ -209,15 +209,14 @@ $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
209
209
  return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
210
210
  })), 'JSON', {
211
211
  stringify: function stringify(it) {
212
- if (it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
213
212
  var args = [it];
214
213
  var i = 1;
215
214
  var replacer, $replacer;
216
215
  while (arguments.length > i) args.push(arguments[i++]);
217
- replacer = args[1];
218
- if (typeof replacer == 'function') $replacer = replacer;
219
- if ($replacer || !isArray(replacer)) replacer = function (key, value) {
220
- if ($replacer) value = $replacer.call(this, key, value);
216
+ $replacer = replacer = args[1];
217
+ if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
218
+ if (!isArray(replacer)) replacer = function (key, value) {
219
+ if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
221
220
  if (!isSymbol(value)) return value;
222
221
  };
223
222
  args[1] = replacer;
@@ -176,7 +176,7 @@ redefineAll($Observable, {
176
176
  });
177
177
  },
178
178
  of: function of() {
179
- for (var i = 0, l = arguments.length, items = Array(l); i < l;) items[i] = arguments[i++];
179
+ for (var i = 0, l = arguments.length, items = new Array(l); i < l;) items[i] = arguments[i++];
180
180
  return new (typeof this === 'function' ? this : $Observable)(function (observer) {
181
181
  var done = false;
182
182
  microtask(function () {
@@ -2,8 +2,10 @@
2
2
  // https://github.com/tc39/proposal-string-pad-start-end
3
3
  var $export = require('./_export');
4
4
  var $pad = require('./_string-pad');
5
+ var userAgent = require('./_user-agent');
5
6
 
6
- $export($export.P, 'String', {
7
+ // https://github.com/zloirock/core-js/issues/280
8
+ $export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', {
7
9
  padEnd: function padEnd(maxLength /* , fillString = ' ' */) {
8
10
  return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false);
9
11
  }
@@ -2,8 +2,10 @@
2
2
  // https://github.com/tc39/proposal-string-pad-start-end
3
3
  var $export = require('./_export');
4
4
  var $pad = require('./_string-pad');
5
+ var userAgent = require('./_user-agent');
5
6
 
6
- $export($export.P, 'String', {
7
+ // https://github.com/zloirock/core-js/issues/280
8
+ $export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', {
7
9
  padStart: function padStart(maxLength /* , fillString = ' ' */) {
8
10
  return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true);
9
11
  }
@@ -1,19 +1,18 @@
1
1
  // ie9- setTimeout & setInterval additional parameters fix
2
2
  var global = require('./_global');
3
3
  var $export = require('./_export');
4
- var invoke = require('./_invoke');
5
- var partial = require('./_partial');
6
- var navigator = global.navigator;
7
- var MSIE = !!navigator && /MSIE .\./.test(navigator.userAgent); // <- dirty ie9- check
4
+ var userAgent = require('./_user-agent');
5
+ var slice = [].slice;
6
+ var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check
8
7
  var wrap = function (set) {
9
- return MSIE ? function (fn, time /* , ...args */) {
10
- return set(invoke(
11
- partial,
12
- [].slice.call(arguments, 2),
8
+ return function (fn, time /* , ...args */) {
9
+ var boundArgs = arguments.length > 2;
10
+ var args = boundArgs ? slice.call(arguments, 2) : false;
11
+ return set(boundArgs ? function () {
13
12
  // eslint-disable-next-line no-new-func
14
- typeof fn == 'function' ? fn : Function(fn)
15
- ), time);
16
- } : set;
13
+ (typeof fn == 'function' ? fn : Function(fn)).apply(this, args);
14
+ } : fn, time);
15
+ };
17
16
  };
18
17
  $export($export.G + $export.B + $export.F * MSIE, {
19
18
  setTimeout: wrap(global.setTimeout),
@@ -1,4 +1,4 @@
1
- require('../modules/es7.symbol.async-iterator');
2
1
  require('../modules/es7.string.trim-left');
3
2
  require('../modules/es7.string.trim-right');
3
+ require('../modules/es7.symbol.async-iterator');
4
4
  module.exports = require('./3');
package/modules/_core.js CHANGED
@@ -1,2 +1,2 @@
1
- var core = module.exports = { version: '2.5.0' };
1
+ var core = module.exports = { version: '2.5.4' };
2
2
  if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
@@ -3,7 +3,6 @@ var LIBRARY = require('./_library');
3
3
  var $export = require('./_export');
4
4
  var redefine = require('./_redefine');
5
5
  var hide = require('./_hide');
6
- var has = require('./_has');
7
6
  var Iterators = require('./_iterators');
8
7
  var $iterCreate = require('./_iter-create');
9
8
  var setToStringTag = require('./_set-to-string-tag');
@@ -41,7 +40,7 @@ module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCE
41
40
  // Set @@toStringTag to native iterators
42
41
  setToStringTag(IteratorPrototype, TAG, true);
43
42
  // fix for some old engines
44
- if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
43
+ if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
45
44
  }
46
45
  }
47
46
  // fix Array#{values, @@iterator}.name in V8 / FF
@@ -30,8 +30,8 @@ module.exports = function () {
30
30
  notify = function () {
31
31
  process.nextTick(flush);
32
32
  };
33
- // browsers with MutationObserver
34
- } else if (Observer) {
33
+ // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
34
+ } else if (Observer && !(global.navigator && global.navigator.standalone)) {
35
35
  var toggle = true;
36
36
  var node = document.createTextNode('');
37
37
  new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
@@ -5,7 +5,7 @@ var aFunction = require('./_a-function');
5
5
  module.exports = function (/* ...pargs */) {
6
6
  var fn = aFunction(this);
7
7
  var length = arguments.length;
8
- var pargs = Array(length);
8
+ var pargs = new Array(length);
9
9
  var i = 0;
10
10
  var _ = path._;
11
11
  var holder = false;
@@ -1,6 +1,10 @@
1
+ var anObject = require('./_an-object');
2
+ var isObject = require('./_is-object');
1
3
  var newPromiseCapability = require('./_new-promise-capability');
2
4
 
3
5
  module.exports = function (C, x) {
6
+ anObject(C);
7
+ if (isObject(x) && x.constructor === C) return x;
4
8
  var promiseCapability = newPromiseCapability.f(C);
5
9
  var resolve = promiseCapability.resolve;
6
10
  resolve(x);
@@ -5,7 +5,7 @@ var $export = require('./_export');
5
5
  module.exports = function (COLLECTION) {
6
6
  $export($export.S, COLLECTION, { of: function of() {
7
7
  var length = arguments.length;
8
- var A = Array(length);
8
+ var A = new Array(length);
9
9
  while (length--) A[length] = arguments[length];
10
10
  return new this(A);
11
11
  } });
@@ -40,7 +40,7 @@ var $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET;
40
40
 
41
41
  // IEEE754 conversions based on https://github.com/feross/ieee754
42
42
  function packIEEE754(value, mLen, nBytes) {
43
- var buffer = Array(nBytes);
43
+ var buffer = new Array(nBytes);
44
44
  var eLen = nBytes * 8 - mLen - 1;
45
45
  var eMax = (1 << eLen) - 1;
46
46
  var eBias = eMax >> 1;
@@ -158,7 +158,7 @@ if (!$typed.ABV) {
158
158
  $ArrayBuffer = function ArrayBuffer(length) {
159
159
  anInstance(this, $ArrayBuffer, ARRAY_BUFFER);
160
160
  var byteLength = toIndex(length);
161
- this._b = arrayFill.call(Array(byteLength), 0);
161
+ this._b = arrayFill.call(new Array(byteLength), 0);
162
162
  this[$LENGTH] = byteLength;
163
163
  };
164
164
 
@@ -0,0 +1,4 @@
1
+ var global = require('./_global');
2
+ var navigator = global.navigator;
3
+
4
+ module.exports = navigator && navigator.userAgent || '';
@@ -18,7 +18,7 @@ $export($export.P + $export.F * require('./_fails')(function () {
18
18
  var start = toAbsoluteIndex(begin, len);
19
19
  var upTo = toAbsoluteIndex(end, len);
20
20
  var size = toLength(upTo - start);
21
- var cloned = Array(size);
21
+ var cloned = new Array(size);
22
22
  var i = 0;
23
23
  for (; i < size; i++) cloned[i] = klass == 'String'
24
24
  ? this.charAt(start + i)
@@ -36,12 +36,6 @@ var USE_NATIVE = !!function () {
36
36
  }();
37
37
 
38
38
  // helpers
39
- var sameConstructor = LIBRARY ? function (a, b) {
40
- // with library wrapper special case
41
- return a === b || a === $Promise && b === Wrapper;
42
- } : function (a, b) {
43
- return a === b;
44
- };
45
39
  var isThenable = function (it) {
46
40
  var then;
47
41
  return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
@@ -59,7 +53,7 @@ var notify = function (promise, isReject) {
59
53
  var resolve = reaction.resolve;
60
54
  var reject = reaction.reject;
61
55
  var domain = reaction.domain;
62
- var result, then;
56
+ var result, then, exited;
63
57
  try {
64
58
  if (handler) {
65
59
  if (!ok) {
@@ -69,8 +63,11 @@ var notify = function (promise, isReject) {
69
63
  if (handler === true) result = value;
70
64
  else {
71
65
  if (domain) domain.enter();
72
- result = handler(value);
73
- if (domain) domain.exit();
66
+ result = handler(value); // may throw
67
+ if (domain) {
68
+ domain.exit();
69
+ exited = true;
70
+ }
74
71
  }
75
72
  if (result === reaction.promise) {
76
73
  reject(TypeError('Promise-chain cycle'));
@@ -79,6 +76,7 @@ var notify = function (promise, isReject) {
79
76
  } else resolve(result);
80
77
  } else reject(value);
81
78
  } catch (e) {
79
+ if (domain && !exited) domain.exit();
82
80
  reject(e);
83
81
  }
84
82
  };
@@ -110,14 +108,7 @@ var onUnhandled = function (promise) {
110
108
  });
111
109
  };
112
110
  var isUnhandled = function (promise) {
113
- if (promise._h == 1) return false;
114
- var chain = promise._a || promise._c;
115
- var i = 0;
116
- var reaction;
117
- while (chain.length > i) {
118
- reaction = chain[i++];
119
- if (reaction.fail || !isUnhandled(reaction.promise)) return false;
120
- } return true;
111
+ return promise._h !== 1 && (promise._a || promise._c).length === 0;
121
112
  };
122
113
  var onHandleUnhandled = function (promise) {
123
114
  task.call(global, function () {
@@ -213,7 +204,7 @@ if (!USE_NATIVE) {
213
204
  this.reject = ctx($reject, promise, 1);
214
205
  };
215
206
  newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
216
- return sameConstructor($Promise, C)
207
+ return C === $Promise || C === Wrapper
217
208
  ? new OwnPromiseCapability(C)
218
209
  : newGenericPromiseCapability(C);
219
210
  };
@@ -237,9 +228,7 @@ $export($export.S + $export.F * !USE_NATIVE, PROMISE, {
237
228
  $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
238
229
  // 25.4.4.6 Promise.resolve(x)
239
230
  resolve: function resolve(x) {
240
- // instanceof instead of internal slot check because we should fix it without replacement native Promise core
241
- if (x instanceof $Promise && sameConstructor(x.constructor, this)) return x;
242
- return promiseResolve(this, x);
231
+ return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);
243
232
  }
244
233
  });
245
234
  $export($export.S + $export.F * !(USE_NATIVE && require('./_iter-detect')(function (iter) {
@@ -13,10 +13,10 @@ var uid = require('./_uid');
13
13
  var wks = require('./_wks');
14
14
  var wksExt = require('./_wks-ext');
15
15
  var wksDefine = require('./_wks-define');
16
- var keyOf = require('./_keyof');
17
16
  var enumKeys = require('./_enum-keys');
18
17
  var isArray = require('./_is-array');
19
18
  var anObject = require('./_an-object');
19
+ var isObject = require('./_is-object');
20
20
  var toIObject = require('./_to-iobject');
21
21
  var toPrimitive = require('./_to-primitive');
22
22
  var createDesc = require('./_property-desc');
@@ -177,9 +177,9 @@ $export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
177
177
  : SymbolRegistry[key] = $Symbol(key);
178
178
  },
179
179
  // 19.4.2.5 Symbol.keyFor(sym)
180
- keyFor: function keyFor(key) {
181
- if (isSymbol(key)) return keyOf(SymbolRegistry, key);
182
- throw TypeError(key + ' is not a symbol!');
180
+ keyFor: function keyFor(sym) {
181
+ if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
182
+ for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
183
183
  },
184
184
  useSetter: function () { setter = true; },
185
185
  useSimple: function () { setter = false; }
@@ -209,15 +209,14 @@ $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
209
209
  return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
210
210
  })), 'JSON', {
211
211
  stringify: function stringify(it) {
212
- if (it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
213
212
  var args = [it];
214
213
  var i = 1;
215
214
  var replacer, $replacer;
216
215
  while (arguments.length > i) args.push(arguments[i++]);
217
- replacer = args[1];
218
- if (typeof replacer == 'function') $replacer = replacer;
219
- if ($replacer || !isArray(replacer)) replacer = function (key, value) {
220
- if ($replacer) value = $replacer.call(this, key, value);
216
+ $replacer = replacer = args[1];
217
+ if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
218
+ if (!isArray(replacer)) replacer = function (key, value) {
219
+ if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
221
220
  if (!isSymbol(value)) return value;
222
221
  };
223
222
  args[1] = replacer;
@@ -176,7 +176,7 @@ redefineAll($Observable, {
176
176
  });
177
177
  },
178
178
  of: function of() {
179
- for (var i = 0, l = arguments.length, items = Array(l); i < l;) items[i] = arguments[i++];
179
+ for (var i = 0, l = arguments.length, items = new Array(l); i < l;) items[i] = arguments[i++];
180
180
  return new (typeof this === 'function' ? this : $Observable)(function (observer) {
181
181
  var done = false;
182
182
  microtask(function () {
@@ -2,8 +2,10 @@
2
2
  // https://github.com/tc39/proposal-string-pad-start-end
3
3
  var $export = require('./_export');
4
4
  var $pad = require('./_string-pad');
5
+ var userAgent = require('./_user-agent');
5
6
 
6
- $export($export.P, 'String', {
7
+ // https://github.com/zloirock/core-js/issues/280
8
+ $export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', {
7
9
  padEnd: function padEnd(maxLength /* , fillString = ' ' */) {
8
10
  return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false);
9
11
  }
@@ -2,8 +2,10 @@
2
2
  // https://github.com/tc39/proposal-string-pad-start-end
3
3
  var $export = require('./_export');
4
4
  var $pad = require('./_string-pad');
5
+ var userAgent = require('./_user-agent');
5
6
 
6
- $export($export.P, 'String', {
7
+ // https://github.com/zloirock/core-js/issues/280
8
+ $export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', {
7
9
  padStart: function padStart(maxLength /* , fillString = ' ' */) {
8
10
  return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true);
9
11
  }