Skip to content

whilst does not return value from iterator #40

@JamesHight

Description

@JamesHight

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);
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions