esnext.iterator.to-array.js 431 B

123456789101112131415
  1. 'use strict';
  2. // https://github.com/tc39/proposal-iterator-helpers
  3. var $ = require('../internals/export');
  4. var iterate = require('../internals/iterate');
  5. var anObject = require('../internals/an-object');
  6. var push = [].push;
  7. $({ target: 'Iterator', proto: true, real: true }, {
  8. toArray: function toArray() {
  9. var result = [];
  10. iterate(anObject(this), push, { that: result, IS_ITERATOR: true });
  11. return result;
  12. }
  13. });