Constructs a promise of state snapshots for an object whose values are promises.

npm install then-all-settled-in
6 downloads in the last day
24 downloads in the last week
37 downloads in the last month


then-all-settled-in is an object-aware variant of Q's allSettled method. The allSettledIn function returns a promise that is fulfilled with a new object containing the state snapshots for each object member. When combined with then-all-in, this form can be helpful for conditionally queueing asynchronous operations.

$ npm i then-all-settled-in


var allIn = require('then-all-in'),
    allSettledIn = require('then-all-settled-in'),
    emails = require('./emails');

app.patch('/account/:id', function(request, response, next) {
    var body = request.body;

    // Assume `emails.validateEmail()` is an asynchronous operation that
    // resolves to a Boolean, and `Account.get` constructs a promise for
    // an account model.
    var operations = allSettledIn({
        validation: emails.validateEmail(,
        byId: Account.get(

    operations.then(function(responses) {
        var changes = {},
            validation = responses.validation,
            byId = responses.byId;

        if (byId.state == 'rejected')
            throw byId.reason;

        var account = byId.value;
        if (validation.state == 'fulfilled' && validation.value === true && != {
            // Assume `#setEmail()` is asynchronous.
   = account.setEmail(;

        if ( != {
   = account.setPhone(;

        return allIn(changes);
    }).done(function() {
    }, next);



npm loves you