2 // https://github.com/tc39/proposal-iterator-helpers
3 var $ = require('../internals/export');
4 var apply = require('../internals/function-apply');
5 var anObject = require('../internals/an-object');
6 var createIteratorProxy = require('../internals/iterator-create-proxy');
8 var IteratorProxy = createIteratorProxy(function (args) {
9 var result = anObject(apply(this.next, this.iterator, args));
10 var done = this.done = !!result.done;
11 if (!done) return [this.index++, result.value];
14 $({ target: 'Iterator', proto: true, real: true }, {
15 asIndexedPairs: function asIndexedPairs() {
16 return new IteratorProxy({
17 iterator: anObject(this),