massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / modules / esnext.iterator.as-indexed-pairs.js
1 'use strict';
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');
7
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];
12 });
13
14 $({ target: 'Iterator', proto: true, real: true }, {
15   asIndexedPairs: function asIndexedPairs() {
16     return new IteratorProxy({
17       iterator: anObject(this),
18       index: 0
19     });
20   }
21 });