11 lines
287 B
JavaScript
11 lines
287 B
JavaScript
var call = require('../internals/function-call');
|
|
|
|
module.exports = function (iterator, fn, $next) {
|
|
var next = $next || iterator.next;
|
|
var step, result;
|
|
while (!(step = call(next, iterator)).done) {
|
|
result = fn(step.value);
|
|
if (result !== undefined) return result;
|
|
}
|
|
};
|