object-ready
v1.0.1
Published
Wait for all the promise values in an object to be ready
Downloads
4
Maintainers
Readme
Object Ready
A simple function that takes an object with optional promise values and returns a promise which is triggered when all those promises have completed.
Example
Very useful for rendering a view with some async values in express for instance:
var ready = require('object-ready');
...set up app and db connections...
app.get('/users', function(req, res, next) {
ready({
title: 'List of users',
users: db.getUsers()
}).then(function(locals) {
res.render('users', locals);
});
});