core-js-pure 3.19.2 → 3.19.3

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.
@@ -10,8 +10,9 @@ var AsyncIteratorPrototype = require('../internals/async-iterator-prototype');
10
10
 
11
11
  var Promise = getBuiltIn('Promise');
12
12
 
13
+ var ASYNC_FROM_SYNC_ITERATOR = 'AsyncFromSyncIterator';
13
14
  var setInternalState = InternalStateModule.set;
14
- var getInternalState = InternalStateModule.get;
15
+ var getInternalState = InternalStateModule.getterFor(ASYNC_FROM_SYNC_ITERATOR);
15
16
 
16
17
  var asyncFromSyncIteratorContinuation = function (result, resolve, reject) {
17
18
  var done = result.done;
@@ -22,6 +23,7 @@ var asyncFromSyncIteratorContinuation = function (result, resolve, reject) {
22
23
 
23
24
  var AsyncFromSyncIterator = function AsyncIterator(iterator) {
24
25
  setInternalState(this, {
26
+ type: ASYNC_FROM_SYNC_ITERATOR,
25
27
  iterator: anObject(iterator),
26
28
  next: iterator.next
27
29
  });
@@ -13,13 +13,15 @@ var AsyncIteratorPrototype = require('../internals/async-iterator-prototype');
13
13
 
14
14
  var Promise = getBuiltIn('Promise');
15
15
 
16
+ var ASYNC_ITERATOR_PROXY = 'AsyncIteratorProxy';
16
17
  var setInternalState = InternalStateModule.set;
17
- var getInternalState = InternalStateModule.get;
18
+ var getInternalState = InternalStateModule.getterFor(ASYNC_ITERATOR_PROXY);
18
19
 
19
20
  var TO_STRING_TAG = wellKnownSymbol('toStringTag');
20
21
 
21
22
  module.exports = function (nextHandler, IS_ITERATOR) {
22
23
  var AsyncIteratorProxy = function AsyncIterator(state) {
24
+ state.type = ASYNC_ITERATOR_PROXY;
23
25
  state.next = aCallable(state.iterator.next);
24
26
  state.done = false;
25
27
  state.ignoreArgument = !IS_ITERATOR;
@@ -7,9 +7,9 @@ var Iterators = require('../internals/iterators');
7
7
 
8
8
  var returnThis = function () { return this; };
9
9
 
10
- module.exports = function (IteratorConstructor, NAME, next) {
10
+ module.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
11
11
  var TO_STRING_TAG = NAME + ' Iterator';
12
- IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) });
12
+ IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
13
13
  setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
14
14
  Iterators[TO_STRING_TAG] = returnThis;
15
15
  return IteratorConstructor;
@@ -10,13 +10,15 @@ var InternalStateModule = require('../internals/internal-state');
10
10
  var getMethod = require('../internals/get-method');
11
11
  var IteratorPrototype = require('../internals/iterators-core').IteratorPrototype;
12
12
 
13
+ var ITERATOR_PROXY = 'IteratorProxy';
13
14
  var setInternalState = InternalStateModule.set;
14
- var getInternalState = InternalStateModule.get;
15
+ var getInternalState = InternalStateModule.getterFor(ITERATOR_PROXY);
15
16
 
16
17
  var TO_STRING_TAG = wellKnownSymbol('toStringTag');
17
18
 
18
19
  module.exports = function (nextHandler, IS_ITERATOR) {
19
20
  var IteratorProxy = function Iterator(state) {
21
+ state.type = ITERATOR_PROXY;
20
22
  state.next = aCallable(state.iterator.next);
21
23
  state.done = false;
22
24
  state.ignoreArg = !IS_ITERATOR;
@@ -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.19.2',
7
+ version: '3.19.3',
8
8
  mode: IS_PURE ? 'pure' : 'global',
9
9
  copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
10
10
  });
@@ -34,7 +34,7 @@ var V8_VERSION = require('../internals/engine-v8-version');
34
34
  var SPECIES = wellKnownSymbol('species');
35
35
  var PROMISE = 'Promise';
36
36
 
37
- var getInternalState = InternalStateModule.get;
37
+ var getInternalState = InternalStateModule.getterFor(PROMISE);
38
38
  var setInternalState = InternalStateModule.set;
39
39
  var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
40
40
  var NativePromisePrototype = NativePromise && NativePromise.prototype;
@@ -21,42 +21,51 @@ var hostReportErrors = require('../internals/host-report-errors');
21
21
  var wellKnownSymbol = require('../internals/well-known-symbol');
22
22
  var InternalStateModule = require('../internals/internal-state');
23
23
 
24
- var OBSERVABLE = wellKnownSymbol('observable');
25
- var getInternalState = InternalStateModule.get;
24
+ var $$OBSERVABLE = wellKnownSymbol('observable');
25
+ var OBSERVABLE = 'Observable';
26
+ var SUBSCRIPTION = 'Subscription';
27
+ var SUBSCRIPTION_OBSERVER = 'SubscriptionObserver';
28
+ var getterFor = InternalStateModule.getterFor;
26
29
  var setInternalState = InternalStateModule.set;
30
+ var getObservableInternalState = getterFor(OBSERVABLE);
31
+ var getSubscriptionInternalState = getterFor(SUBSCRIPTION);
32
+ var getSubscriptionObserverInternalState = getterFor(SUBSCRIPTION_OBSERVER);
27
33
  var Array = global.Array;
28
34
 
29
- var cleanupSubscription = function (subscriptionState) {
30
- var cleanup = subscriptionState.cleanup;
31
- if (cleanup) {
32
- subscriptionState.cleanup = undefined;
33
- try {
34
- cleanup();
35
- } catch (error) {
36
- hostReportErrors(error);
37
- }
38
- }
39
- };
40
-
41
- var subscriptionClosed = function (subscriptionState) {
42
- return subscriptionState.observer === undefined;
35
+ var SubscriptionState = function (observer) {
36
+ this.observer = anObject(observer);
37
+ this.cleanup = undefined;
38
+ this.subscriptionObserver = undefined;
43
39
  };
44
40
 
45
- var close = function (subscriptionState) {
46
- var subscription = subscriptionState.facade;
47
- if (!DESCRIPTORS) {
48
- subscription.closed = true;
49
- var subscriptionObserver = subscriptionState.subscriptionObserver;
50
- if (subscriptionObserver) subscriptionObserver.closed = true;
51
- } subscriptionState.observer = undefined;
41
+ SubscriptionState.prototype = {
42
+ type: SUBSCRIPTION,
43
+ clean: function () {
44
+ var cleanup = this.cleanup;
45
+ if (cleanup) {
46
+ this.cleanup = undefined;
47
+ try {
48
+ cleanup();
49
+ } catch (error) {
50
+ hostReportErrors(error);
51
+ }
52
+ }
53
+ },
54
+ close: function () {
55
+ if (!DESCRIPTORS) {
56
+ var subscription = this.facade;
57
+ var subscriptionObserver = this.subscriptionObserver;
58
+ subscription.closed = true;
59
+ if (subscriptionObserver) subscriptionObserver.closed = true;
60
+ } this.observer = undefined;
61
+ },
62
+ isClosed: function () {
63
+ return this.observer === undefined;
64
+ }
52
65
  };
53
66
 
54
67
  var Subscription = function (observer, subscriber) {
55
- var subscriptionState = setInternalState(this, {
56
- cleanup: undefined,
57
- observer: anObject(observer),
58
- subscriptionObserver: undefined
59
- });
68
+ var subscriptionState = setInternalState(this, new SubscriptionState(observer));
60
69
  var start;
61
70
  if (!DESCRIPTORS) this.closed = false;
62
71
  try {
@@ -64,8 +73,8 @@ var Subscription = function (observer, subscriber) {
64
73
  } catch (error) {
65
74
  hostReportErrors(error);
66
75
  }
67
- if (subscriptionClosed(subscriptionState)) return;
68
- var subscriptionObserver = subscriptionState.subscriptionObserver = new SubscriptionObserver(this);
76
+ if (subscriptionState.isClosed()) return;
77
+ var subscriptionObserver = subscriptionState.subscriptionObserver = new SubscriptionObserver(subscriptionState);
69
78
  try {
70
79
  var cleanup = subscriber(subscriptionObserver);
71
80
  var subscription = cleanup;
@@ -75,15 +84,15 @@ var Subscription = function (observer, subscriber) {
75
84
  } catch (error) {
76
85
  subscriptionObserver.error(error);
77
86
  return;
78
- } if (subscriptionClosed(subscriptionState)) cleanupSubscription(subscriptionState);
87
+ } if (subscriptionState.isClosed()) subscriptionState.clean();
79
88
  };
80
89
 
81
90
  Subscription.prototype = redefineAll({}, {
82
91
  unsubscribe: function unsubscribe() {
83
- var subscriptionState = getInternalState(this);
84
- if (!subscriptionClosed(subscriptionState)) {
85
- close(subscriptionState);
86
- cleanupSubscription(subscriptionState);
92
+ var subscriptionState = getSubscriptionInternalState(this);
93
+ if (!subscriptionState.isClosed()) {
94
+ subscriptionState.close();
95
+ subscriptionState.clean();
87
96
  }
88
97
  }
89
98
  });
@@ -91,19 +100,22 @@ Subscription.prototype = redefineAll({}, {
91
100
  if (DESCRIPTORS) defineProperty(Subscription.prototype, 'closed', {
92
101
  configurable: true,
93
102
  get: function () {
94
- return subscriptionClosed(getInternalState(this));
103
+ return getSubscriptionInternalState(this).isClosed();
95
104
  }
96
105
  });
97
106
 
98
- var SubscriptionObserver = function (subscription) {
99
- setInternalState(this, { subscription: subscription });
107
+ var SubscriptionObserver = function (subscriptionState) {
108
+ setInternalState(this, {
109
+ type: SUBSCRIPTION_OBSERVER,
110
+ subscriptionState: subscriptionState
111
+ });
100
112
  if (!DESCRIPTORS) this.closed = false;
101
113
  };
102
114
 
103
115
  SubscriptionObserver.prototype = redefineAll({}, {
104
116
  next: function next(value) {
105
- var subscriptionState = getInternalState(getInternalState(this).subscription);
106
- if (!subscriptionClosed(subscriptionState)) {
117
+ var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState;
118
+ if (!subscriptionState.isClosed()) {
107
119
  var observer = subscriptionState.observer;
108
120
  try {
109
121
  var nextMethod = getMethod(observer, 'next');
@@ -114,30 +126,30 @@ SubscriptionObserver.prototype = redefineAll({}, {
114
126
  }
115
127
  },
116
128
  error: function error(value) {
117
- var subscriptionState = getInternalState(getInternalState(this).subscription);
118
- if (!subscriptionClosed(subscriptionState)) {
129
+ var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState;
130
+ if (!subscriptionState.isClosed()) {
119
131
  var observer = subscriptionState.observer;
120
- close(subscriptionState);
132
+ subscriptionState.close();
121
133
  try {
122
134
  var errorMethod = getMethod(observer, 'error');
123
135
  if (errorMethod) call(errorMethod, observer, value);
124
136
  else hostReportErrors(value);
125
137
  } catch (err) {
126
138
  hostReportErrors(err);
127
- } cleanupSubscription(subscriptionState);
139
+ } subscriptionState.clean();
128
140
  }
129
141
  },
130
142
  complete: function complete() {
131
- var subscriptionState = getInternalState(getInternalState(this).subscription);
132
- if (!subscriptionClosed(subscriptionState)) {
143
+ var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState;
144
+ if (!subscriptionState.isClosed()) {
133
145
  var observer = subscriptionState.observer;
134
- close(subscriptionState);
146
+ subscriptionState.close();
135
147
  try {
136
148
  var completeMethod = getMethod(observer, 'complete');
137
149
  if (completeMethod) call(completeMethod, observer);
138
150
  } catch (error) {
139
151
  hostReportErrors(error);
140
- } cleanupSubscription(subscriptionState);
152
+ } subscriptionState.clean();
141
153
  }
142
154
  }
143
155
  });
@@ -145,13 +157,16 @@ SubscriptionObserver.prototype = redefineAll({}, {
145
157
  if (DESCRIPTORS) defineProperty(SubscriptionObserver.prototype, 'closed', {
146
158
  configurable: true,
147
159
  get: function () {
148
- return subscriptionClosed(getInternalState(getInternalState(this).subscription));
160
+ return getSubscriptionObserverInternalState(this).subscriptionState.isClosed();
149
161
  }
150
162
  });
151
163
 
152
164
  var $Observable = function Observable(subscriber) {
153
165
  anInstance(this, ObservablePrototype);
154
- setInternalState(this, { subscriber: aCallable(subscriber) });
166
+ setInternalState(this, {
167
+ type: OBSERVABLE,
168
+ subscriber: aCallable(subscriber)
169
+ });
155
170
  };
156
171
 
157
172
  var ObservablePrototype = $Observable.prototype;
@@ -163,14 +178,14 @@ redefineAll(ObservablePrototype, {
163
178
  next: observer,
164
179
  error: length > 1 ? arguments[1] : undefined,
165
180
  complete: length > 2 ? arguments[2] : undefined
166
- } : isObject(observer) ? observer : {}, getInternalState(this).subscriber);
181
+ } : isObject(observer) ? observer : {}, getObservableInternalState(this).subscriber);
167
182
  }
168
183
  });
169
184
 
170
185
  redefineAll($Observable, {
171
186
  from: function from(x) {
172
187
  var C = isConstructor(this) ? this : $Observable;
173
- var observableMethod = getMethod(anObject(x), OBSERVABLE);
188
+ var observableMethod = getMethod(anObject(x), $$OBSERVABLE);
174
189
  if (observableMethod) {
175
190
  var observable = anObject(call(observableMethod, x));
176
191
  return observable.constructor === C ? observable : new C(function (observer) {
@@ -201,10 +216,10 @@ redefineAll($Observable, {
201
216
  }
202
217
  });
203
218
 
204
- redefine(ObservablePrototype, OBSERVABLE, function () { return this; });
219
+ redefine(ObservablePrototype, $$OBSERVABLE, function () { return this; });
205
220
 
206
221
  $({ global: true }, {
207
222
  Observable: $Observable
208
223
  });
209
224
 
210
- setSpecies('Observable');
225
+ setSpecies(OBSERVABLE);
@@ -117,7 +117,7 @@ var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params
117
117
  if (!step.done) {
118
118
  step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [entry.key, entry.value];
119
119
  } return step;
120
- });
120
+ }, true);
121
121
 
122
122
  var URLSearchParamsState = function (init) {
123
123
  this.entries = [];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "core-js-pure",
3
3
  "description": "Standard library",
4
- "version": "3.19.2",
4
+ "version": "3.19.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/zloirock/core-js.git"
@@ -54,5 +54,5 @@
54
54
  "scripts": {
55
55
  "postinstall": "node -e \"try{require('./postinstall')}catch(e){}\""
56
56
  },
57
- "gitHead": "e49b7f34f7b3a10cc88e1210431508c7a58e069b"
57
+ "gitHead": "7dae270c1acf496ba701acfc6272453d7c06aa53"
58
58
  }