core-js-pure 3.4.0 → 3.4.1

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.
@@ -0,0 +1,3 @@
1
+ var userAgent = require('../internals/user-agent');
2
+
3
+ module.exports = /(iphone|ipod|ipad).*applewebkit/i.test(userAgent);
@@ -2,7 +2,7 @@ var global = require('../internals/global');
2
2
  var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
3
3
  var classof = require('../internals/classof-raw');
4
4
  var macrotask = require('../internals/task').set;
5
- var userAgent = require('../internals/user-agent');
5
+ var IS_IOS = require('../internals/is-ios');
6
6
 
7
7
  var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
8
8
  var process = global.process;
@@ -39,7 +39,7 @@ if (!queueMicrotask) {
39
39
  process.nextTick(flush);
40
40
  };
41
41
  // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
42
- } else if (MutationObserver && !/(iphone|ipod|ipad).*applewebkit/i.test(userAgent)) {
42
+ } else if (MutationObserver && !IS_IOS) {
43
43
  toggle = true;
44
44
  node = document.createTextNode('');
45
45
  new MutationObserver(flush).observe(node, { characterData: true });
@@ -4,7 +4,7 @@ var store = require('../internals/shared-store');
4
4
  (module.exports = function (key, value) {
5
5
  return store[key] || (store[key] = value !== undefined ? value : {});
6
6
  })('versions', []).push({
7
- version: '3.4.0',
7
+ version: '3.4.1',
8
8
  mode: IS_PURE ? 'pure' : 'global',
9
9
  copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
10
10
  });
package/internals/task.js CHANGED
@@ -4,7 +4,7 @@ var classof = require('../internals/classof-raw');
4
4
  var bind = require('../internals/bind-context');
5
5
  var html = require('../internals/html');
6
6
  var createElement = require('../internals/document-create-element');
7
- var userAgent = require('../internals/user-agent');
7
+ var IS_IOS = require('../internals/is-ios');
8
8
 
9
9
  var location = global.location;
10
10
  var set = global.setImmediate;
@@ -69,7 +69,7 @@ if (!set || !clear) {
69
69
  };
70
70
  // Browsers with MessageChannel, includes WebWorkers
71
71
  // except iOS - https://github.com/zloirock/core-js/issues/624
72
- } else if (MessageChannel && !/(iphone|ipod|ipad).*applewebkit/i.test(userAgent)) {
72
+ } else if (MessageChannel && !IS_IOS) {
73
73
  channel = new MessageChannel();
74
74
  port = channel.port2;
75
75
  channel.port1.onmessage = listener;
@@ -5,8 +5,8 @@ var toObject = require('../internals/to-object');
5
5
  var fails = require('../internals/fails');
6
6
  var sloppyArrayMethod = require('../internals/sloppy-array-method');
7
7
 
8
- var nativeSort = [].sort;
9
- var test = [1, 2, 3];
8
+ var test = [];
9
+ var nativeSort = test.sort;
10
10
 
11
11
  // IE8-
12
12
  var FAILS_ON_UNDEFINED = fails(function () {
@@ -6,6 +6,7 @@ var getBuiltIn = require('../internals/get-built-in');
6
6
  var NativePromise = require('../internals/native-promise-constructor');
7
7
  var redefine = require('../internals/redefine');
8
8
  var redefineAll = require('../internals/redefine-all');
9
+ var shared = require('../internals/shared');
9
10
  var setToStringTag = require('../internals/set-to-string-tag');
10
11
  var setSpecies = require('../internals/set-species');
11
12
  var isObject = require('../internals/is-object');
@@ -35,6 +36,7 @@ var PromiseConstructor = NativePromise;
35
36
  var TypeError = global.TypeError;
36
37
  var document = global.document;
37
38
  var process = global.process;
39
+ var inspectSource = shared('inspectSource');
38
40
  var $fetch = getBuiltIn('fetch');
39
41
  var newPromiseCapability = newPromiseCapabilityModule.f;
40
42
  var newGenericPromiseCapability = newPromiseCapability;
@@ -50,12 +52,13 @@ var UNHANDLED = 2;
50
52
  var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
51
53
 
52
54
  var FORCED = isForced(PROMISE, function () {
55
+ var GLOBAL_CORE_JS_PROMISE = inspectSource(PromiseConstructor) !== String(PromiseConstructor);
53
56
  // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
54
57
  // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
55
58
  // We can't detect it synchronously, so just check versions
56
59
  if (V8_VERSION === 66) return true;
57
60
  // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
58
- if (!IS_NODE && typeof PromiseRejectionEvent != 'function') return true;
61
+ if (!GLOBAL_CORE_JS_PROMISE && !IS_NODE && typeof PromiseRejectionEvent != 'function') return true;
59
62
  // We need Promise#finally in the pure version for preventing prototype pollution
60
63
  if (IS_PURE && !PromiseConstructor.prototype['finally']) return true;
61
64
  // We can't use @@species feature detection in V8 since it causes
@@ -8,7 +8,6 @@ var defineProperty = require('../internals/object-define-property');
8
8
  var createPropertyDescriptor = require('../internals/create-property-descriptor');
9
9
  var iterate = require('../internals/iterate');
10
10
  var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
11
- var anObject = require('../internals/an-object');
12
11
  var InternalStateModule = require('../internals/internal-state');
13
12
 
14
13
  var setInternalState = InternalStateModule.set;
@@ -31,14 +30,7 @@ var $AggregateError = function AggregateError(errors, message) {
31
30
  $AggregateError.prototype = create(Error.prototype, {
32
31
  constructor: createPropertyDescriptor(5, $AggregateError),
33
32
  message: createPropertyDescriptor(5, ''),
34
- name: createPropertyDescriptor(5, 'AggregateError'),
35
- toString: createPropertyDescriptor(5, function toString() {
36
- var name = anObject(this).name;
37
- name = name === undefined ? 'AggregateError' : String(name);
38
- var message = this.message;
39
- message = message === undefined ? '' : String(message);
40
- return name + ': ' + message;
41
- })
33
+ name: createPropertyDescriptor(5, 'AggregateError')
42
34
  });
43
35
 
44
36
  if (DESCRIPTORS) defineProperty.f($AggregateError.prototype, 'errors', {
@@ -3,7 +3,6 @@
3
3
  var $ = require('../internals/export');
4
4
  var aFunction = require('../internals/a-function');
5
5
  var anObject = require('../internals/an-object');
6
- var isObject = require('../internals/is-object');
7
6
  var createAsyncIteratorProxy = require('../internals/create-async-iterator-proxy');
8
7
  var getAsyncIteratorMethod = require('../internals/get-async-iterator-method');
9
8
 
@@ -23,11 +22,12 @@ var AsyncIteratorProxy = createAsyncIteratorProxy(function (arg, Promise) {
23
22
  } else {
24
23
  Promise.resolve(mapper(step.value)).then(function (mapped) {
25
24
  try {
26
- if (isObject(mapped) && (iteratorMethod = getAsyncIteratorMethod(mapped)) !== undefined) {
27
- state.innerIterator = innerIterator = iteratorMethod.call(mapped);
25
+ iteratorMethod = getAsyncIteratorMethod(mapped);
26
+ if (iteratorMethod !== undefined) {
27
+ state.innerIterator = innerIterator = anObject(iteratorMethod.call(mapped));
28
28
  state.innerNext = aFunction(innerIterator.next);
29
29
  return innerLoop();
30
- } resolve({ done: false, value: mapped });
30
+ } reject(TypeError('.flatMap callback should return an iterable object'));
31
31
  } catch (error2) { reject(error2); }
32
32
  }, reject);
33
33
  }
@@ -3,7 +3,6 @@
3
3
  var $ = require('../internals/export');
4
4
  var aFunction = require('../internals/a-function');
5
5
  var anObject = require('../internals/an-object');
6
- var isObject = require('../internals/is-object');
7
6
  var getIteratorMethod = require('../internals/get-iterator-method');
8
7
  var createIteratorProxy = require('../internals/create-iterator-proxy');
9
8
  var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');
@@ -24,12 +23,14 @@ var IteratorProxy = createIteratorProxy(function (arg) {
24
23
  if (this.done = !!result.done) return;
25
24
 
26
25
  mapped = callWithSafeIterationClosing(iterator, this.mapper, result.value);
26
+ iteratorMethod = getIteratorMethod(mapped);
27
27
 
28
- if (isObject(mapped) && (iteratorMethod = getIteratorMethod(mapped)) !== undefined) {
29
- this.innerIterator = innerIterator = iteratorMethod.call(mapped);
30
- this.innerNext = aFunction(innerIterator.next);
31
- continue;
32
- } return mapped;
28
+ if (iteratorMethod === undefined) {
29
+ throw TypeError('.flatMap callback should return an iterable object');
30
+ }
31
+
32
+ this.innerIterator = innerIterator = anObject(iteratorMethod.call(mapped));
33
+ this.innerNext = aFunction(innerIterator.next);
33
34
  }
34
35
  });
35
36
 
@@ -14,7 +14,7 @@ var RegExpPrototype = RegExp.prototype;
14
14
  $({ target: 'String', proto: true }, {
15
15
  replaceAll: function replaceAll(searchValue, replaceValue) {
16
16
  var O = requireObjectCoercible(this);
17
- var IS_REG_EXP, flags, replacer, string, searchString, template, result, index;
17
+ var IS_REG_EXP, flags, replacer, string, searchString, template, result, position, index;
18
18
  if (searchValue != null) {
19
19
  IS_REG_EXP = isRegExp(searchValue);
20
20
  if (IS_REG_EXP) {
@@ -39,8 +39,10 @@ $({ target: 'String', proto: true }, {
39
39
  return template.join(String(replaceValue));
40
40
  }
41
41
  result = template[0];
42
+ position = result.length;
42
43
  for (index = 1; index < template.length; index++) {
43
- result += String(replaceValue(searchString, index - 1, string));
44
+ result += String(replaceValue(searchString, position, string));
45
+ position += searchString.length + template[index].length;
44
46
  result += template[index];
45
47
  }
46
48
  return result;
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "core-js-pure",
3
3
  "description": "Standard library",
4
- "version": "3.4.0",
4
+ "version": "3.4.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/zloirock/core-js.git"
8
8
  },
9
9
  "main": "index.js",
10
+ "funding": {
11
+ "type": "opencollective",
12
+ "url": "https://opencollective.com/core-js"
13
+ },
10
14
  "license": "MIT",
11
15
  "keywords": [
12
16
  "ES3",