1.0.1 • Published 9 years ago

object-ready v1.0.1

Weekly downloads
2
License
MIT
Repository
-
Last release
9 years ago

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