1 | 'use strict';
|
---|
2 | var $ = require('../internals/export');
|
---|
3 | var anInstance = require('../internals/an-instance');
|
---|
4 | var getPrototypeOf = require('../internals/object-get-prototype-of');
|
---|
5 | var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
---|
6 | var hasOwn = require('../internals/has-own-property');
|
---|
7 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
---|
8 | var AsyncIteratorPrototype = require('../internals/async-iterator-prototype');
|
---|
9 | var IS_PURE = require('../internals/is-pure');
|
---|
10 |
|
---|
11 | var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
---|
12 |
|
---|
13 | var $TypeError = TypeError;
|
---|
14 |
|
---|
15 | var AsyncIteratorConstructor = function AsyncIterator() {
|
---|
16 | anInstance(this, AsyncIteratorPrototype);
|
---|
17 | if (getPrototypeOf(this) === AsyncIteratorPrototype) throw new $TypeError('Abstract class AsyncIterator not directly constructable');
|
---|
18 | };
|
---|
19 |
|
---|
20 | AsyncIteratorConstructor.prototype = AsyncIteratorPrototype;
|
---|
21 |
|
---|
22 | if (!hasOwn(AsyncIteratorPrototype, TO_STRING_TAG)) {
|
---|
23 | createNonEnumerableProperty(AsyncIteratorPrototype, TO_STRING_TAG, 'AsyncIterator');
|
---|
24 | }
|
---|
25 |
|
---|
26 | if (IS_PURE || !hasOwn(AsyncIteratorPrototype, 'constructor') || AsyncIteratorPrototype.constructor === Object) {
|
---|
27 | createNonEnumerableProperty(AsyncIteratorPrototype, 'constructor', AsyncIteratorConstructor);
|
---|
28 | }
|
---|
29 |
|
---|
30 | // `AsyncIterator` constructor
|
---|
31 | // https://github.com/tc39/proposal-async-iterator-helpers
|
---|
32 | $({ global: true, constructor: true, forced: IS_PURE }, {
|
---|
33 | AsyncIterator: AsyncIteratorConstructor
|
---|
34 | });
|
---|