massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / modules / esnext.iterator.map.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 aCallable = require('../internals/a-callable');
6 var anObject = require('../internals/an-object');
7 var createIteratorProxy = require('../internals/iterator-create-proxy');
8 var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');
9
10 var IteratorProxy = createIteratorProxy(function (args) {
11   var iterator = this.iterator;
12   var result = anObject(apply(this.next, iterator, args));
13   var done = this.done = !!result.done;
14   if (!done) return callWithSafeIterationClosing(iterator, this.mapper, result.value);
15 });
16
17 $({ target: 'Iterator', proto: true, real: true }, {
18   map: function map(mapper) {
19     return new IteratorProxy({
20       iterator: anObject(this),
21       mapper: aCallable(mapper)
22     });
23   }
24 });