_iter-create.js 526 B

12345678910111213
  1. 'use strict';
  2. var create = require('./_object-create');
  3. var descriptor = require('./_property-desc');
  4. var setToStringTag = require('./_set-to-string-tag');
  5. var IteratorPrototype = {};
  6. // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
  7. require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; });
  8. module.exports = function (Constructor, NAME, next) {
  9. Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
  10. setToStringTag(Constructor, NAME + ' Iterator');
  11. };