$.iter-create.js 521 B

12345678910111213
  1. 'use strict';
  2. var $ = require('./$')
  3. , descriptor = require('./$.property-desc')
  4. , setToStringTag = require('./$.set-to-string-tag')
  5. , 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. };