Comparing version 0.8.2-2 to 0.8.3-0
34
API.md
@@ -22,4 +22,6 @@ #API Reference | ||
- [`.progress(dynamic value)`](#progressdynamic-value---undefined) | ||
- [`.asCallback`](#ascallback---function) | ||
- [Collections](#collections) | ||
- [`.all()`](#all---promise) | ||
- [`.props()`](#props---promise) | ||
- [`.settle()`](#settle---promise) | ||
@@ -32,2 +34,3 @@ - [`.any()`](#any---promise) | ||
- [`Promise.all(Array<dynamic> values)`](#promiseallarraydynamic-values---promise) | ||
- [`Promise.props(Object object)`](#promisepropsobject-object---promise) | ||
- [`Promise.settle(Array<dynamic> values)`](#promisesettlearraydynamic-values---promise) | ||
@@ -444,2 +447,6 @@ - [`Promise.any(Array<dynamic> values)`](#promiseanyarraydynamic-values---promise) | ||
#####`.props()` -> `Promise` | ||
Same as calling [Promise.props\(thisPromise\)](#promisepropsobject-object---promise) | ||
#####`.settle()` -> `Promise` | ||
@@ -508,2 +515,29 @@ | ||
#####`Promise.props(Object object)` -> `Promise` | ||
Like [`Promise.all`](#promiseallarraydynamic-values---promise) but for object properties instead of array items. Returns a promise that is fulfilled when all the properties of the object are fulfilled. The promise's fulfillment value is an object with fulfillment values at respective keys to the original object. If any promise in the object rejects, the returned promise is rejected with the rejection reason. | ||
If `object` is a trusted `Promise`, then it will be treated as a promise for object rather than for its properties. All other objects are treated for their properties as is returned by `Object.keys` - the object's own enumerable properties. | ||
```js | ||
Promise.props({ | ||
pictures: getPictures(), | ||
comments: getComments(), | ||
tweets: getTweets() | ||
}).then(function(result){ | ||
console.log(result.tweets, result.pictures, result.comments); | ||
}); | ||
``` | ||
Note that if you have no use for the result object other than retrieving the properties, it is more convenient to use [`Promise.all`](#promiseallarraydynamic-values---promise) and [`.spread()`](#spreadfunction-fulfilledhandler--function-rejectedhandler----promise): | ||
```js | ||
Promise.all([getPictures(), getComments(), getTweets()]) | ||
.spread(function(pictures, comments, tweets) { | ||
console.log(pictures, comments, tweets); | ||
}); | ||
``` | ||
*The original object is not modified.* | ||
#####`Promise.settle(Array<dynamic> values)` -> `Promise` | ||
@@ -510,0 +544,0 @@ |
@@ -105,2 +105,3 @@ var astPasses = require("./ast_passes.js"); | ||
"./src/some_promise_array.js", | ||
"./src/properties_promise_array.js", | ||
"./src/promise_inspection.js", | ||
@@ -107,0 +108,0 @@ "./src/promise_resolver.js", |
{ | ||
"name": "bluebird", | ||
"description": "Full featured Promises/A+ implementation with exceptionally good performance", | ||
"version": "0.8.2-2", | ||
"version": "0.8.3-0", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "promise", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
148662
2761