diff --git a/lib/until.js b/lib/until.js index 4f71ce95c..b77b495e1 100644 --- a/lib/until.js +++ b/lib/until.js @@ -26,13 +26,15 @@ import wrapAsync from './internal/wrapAsync'; * * @example * const results = [] + * let finished = false * async.until(function test(page, cb) { - * cb(null, page.next == null) + * cb(null, finished) * }, function iter(next) { * fetchPage(url, (err, body) => { * if (err) return next(err) * results = results.concat(body.objects) - * next(err, body) + * finished = !!body.next + * next(err) * }) * }, function done (err) { * // all pages have been fetched