According to the async documentation, the last iterator value from whilst should be returned to the result handler. This probably is an issue with other calls like until and doWhilst.
https://github.com/caolan/async#whilst
'use strict';
var pasync = require('pasync');
var count = 0;
pasync.whilst(
function () { return count < 5; },
function () {
return new Promise(function(resolve, reject) {
count++;
setTimeout(function () {
resolve(count);
}, 1000);
});
}
).then(function(val) {
console.log('value: ', val); // should be 5
}, function(err) {
console.log('err: ', err);
});
According to the async documentation, the last iterator value from whilst should be returned to the result handler. This probably is an issue with other calls like until and doWhilst.
https://github.com/caolan/async#whilst