1.0.2 • Published 6 years ago

object-promise v1.0.2

Weekly downloads
6
License
MIT
Repository
github
Last release
6 years ago

object-promise

Create a single promise out of an object that has values that may be promises.

Installation

$ npm install object-promise

Usage

var objectPromise = require('object-promise');

var obj = {
  a: Promise.resolve(3), // any promise is fine
  b: 4,                  // non promises are okay too
  c: Promise.resolve(5), // use any number of promises
};

objectPromise(obj).then(function (resolved) {
  // resolved will equal { a: 3, b: 4, c: 5 }
});