Nuclear Package Magnet

    object-ready

    1.0.1 • Public • Published

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

    Install

    npm i object-ready

    DownloadsWeekly Downloads

    4

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • slaskis