11 lines
287 B
JavaScript
Raw Normal View History

2024-04-28 15:34:17 +08:00
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;
}
};