UNPKG

381 BJavaScriptView Raw
1'use strict';
2var call = require('../internals/function-call');
3
4module.exports = function (record, fn, ITERATOR_INSTEAD_OF_RECORD) {
5 var iterator = ITERATOR_INSTEAD_OF_RECORD ? record : record.iterator;
6 var next = record.next;
7 var step, result;
8 while (!(step = call(next, iterator)).done) {
9 result = fn(step.value);
10 if (result !== undefined) return result;
11 }
12};