massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / modules / esnext.iterator.drop.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 call = require('../internals/function-call');
6 var anObject = require('../internals/an-object');
7 var toPositiveInteger = require('../internals/to-positive-integer');
8 var createIteratorProxy = require('../internals/iterator-create-proxy');
9
10 var IteratorProxy = createIteratorProxy(function (args) {
11   var iterator = this.iterator;
12   var next = this.next;
13   var result, done;
14   while (this.remaining) {
15     this.remaining--;
16     result = anObject(call(next, iterator));
17     done = this.done = !!result.done;
18     if (done) return;
19   }
20   result = anObject(apply(next, iterator, args));
21   done = this.done = !!result.done;
22   if (!done) return result.value;
23 });
24
25 $({ target: 'Iterator', proto: true, real: true }, {
26   drop: function drop(limit) {
27     return new IteratorProxy({
28       iterator: anObject(this),
29       remaining: toPositiveInteger(limit)
30     });
31   }
32 });