1 | 'use strict';
|
2 |
|
3 | var $ = require('../internals/export');
|
4 | var anObject = require('../internals/an-object');
|
5 | var createIteratorProxy = require('../internals/create-iterator-proxy');
|
6 |
|
7 | var IteratorProxy = createIteratorProxy(function (arg) {
|
8 | var result = anObject(this.next.call(this.iterator, arg));
|
9 | var done = this.done = !!result.done;
|
10 | if (!done) return [this.index++, result.value];
|
11 | });
|
12 |
|
13 | $({ target: 'Iterator', proto: true, real: true }, {
|
14 | asIndexedPairs: function asIndexedPairs() {
|
15 | return new IteratorProxy({
|
16 | iterator: anObject(this),
|
17 | index: 0
|
18 | });
|
19 | }
|
20 | });
|