What version of async are you using?
v3.1.0 and also master branch
until
The example source codes are as below:
const results = []
async.until(function test(page, cb) {
cb(null, page.next == null)
}, function iter(next) {
fetchPage(url, (err, body) => {
if (err) return next(err)
results = results.concat(body.objects)
next(err, body)
})
}, function done (err) {
// all pages have been fetched
})
But, test function can have only callback function argument. It cannot receive page argument.
When I print out arguments in the above test function, it has only a function as arguments.
Please check this.
whilst
The example source codes are as below:
var count = 0;
async.whilst(
function test(cb) { cb(null, count < 5;) },
function iter(callback) {
count++;
setTimeout(function() {
callback(null, count);
}, 1000);
},
function (err, n) {
// 5 seconds have passed, n = 5
}
);
In test function, semicolon seems to be located at the wrong position.
Maybe, the below code is intended.
function test(cb) { cb(null, count < 5); },
And, in parameter description of test,
asynchronous truth test to perform before each execution of iteratee. Invoked with ().
I think its last sentence seems to be modified as Invoked with (callback) according to the parameter description of until.
What version of async are you using?
v3.1.0 and also master branch
untilThe example source codes are as below:
But,
testfunction can have only callback function argument. It cannot receivepageargument.When I print out
argumentsin the abovetestfunction, it has only a function as arguments.Please check this.
whilstThe example source codes are as below:
In
testfunction, semicolon seems to be located at the wrong position.Maybe, the below code is intended.
And, in parameter description of
test,I think its last sentence seems to be modified as
Invoked with (callback)according to the parameter description ofuntil.