Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
npm module: a promises/a compliant `when`, but for objects instead of arrays
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.gitignore
README.md
index.js
package.json
resolved.js
sample.js

README.md

resolved

Like Promise.all but for Objects

If your friends ask, this is why Promises are cool: they're objects that you can pass around and do things to while you're waiting for their promised values. With resolved, you can embed promises in other objects and then get the aggregate resolved value.

This is similar to the function when, which takes an array of promises and returns a promise for an array of all of the resolved values. resolved does the same, but for objects instead of arrays.

installation

$ npm install resolved

usage

var resolved = require('resolved')

var obj = {
  a: 'a regular value',
  b: promiseOfTrue,
  c: [
    promiseOfFalse,
    promiseOf1
  ]
}

resolved(obj).then(function(resolvedObj) {
  // resolvedObj => {
  //    a: 'a regular value',
  //    b: true,
  //    c: [
  //      promiseOfFalse,
  //      promiseOf1
  //    ]
  //  }
})

resolved.deep(obj).then(function(resolvedObj) {
  // resolvedObj => {
  //    a: 'a regular value',
  //    b: true,
  //    c: [
  //      false,
  //      1
  //    ]
  //  }
})

license

MIT (c) 2015 jden - Jason Denizac jason@denizac.org - http://jden.mit-license.org/2015

Something went wrong with that request. Please try again.