esnext.async-iterator.constructor.js 1.1 KB

1234567891011121314151617181920212223242526272829
  1. 'use strict';
  2. // https://github.com/tc39/proposal-iterator-helpers
  3. var $ = require('../internals/export');
  4. var anInstance = require('../internals/an-instance');
  5. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  6. var has = require('../internals/has');
  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. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  11. var AsyncIteratorConstructor = function AsyncIterator() {
  12. anInstance(this, AsyncIteratorConstructor);
  13. };
  14. AsyncIteratorConstructor.prototype = AsyncIteratorPrototype;
  15. if (!has(AsyncIteratorPrototype, TO_STRING_TAG)) {
  16. createNonEnumerableProperty(AsyncIteratorPrototype, TO_STRING_TAG, 'AsyncIterator');
  17. }
  18. if (!has(AsyncIteratorPrototype, 'constructor') || AsyncIteratorPrototype.constructor === Object) {
  19. createNonEnumerableProperty(AsyncIteratorPrototype, 'constructor', AsyncIteratorConstructor);
  20. }
  21. $({ global: true, forced: IS_PURE }, {
  22. AsyncIterator: AsyncIteratorConstructor
  23. });