bluebird-extra
Advanced tools
Comparing version 0.1.1 to 0.1.3
@@ -14,2 +14,9 @@ // -------------------- | ||
var methods = { | ||
// like bluebird.each() but run in parallel | ||
eachParallel: function(arr, iterator) { | ||
return Promise.map.call(this, arr, function(item, index, value) { | ||
return iterator.call(this, item, index, value); | ||
}.bind(this)).return(arr); | ||
}, | ||
// like bluebird.map() but run in series | ||
@@ -59,3 +66,2 @@ mapSeries: function(arr, iterator) { | ||
// run iterator on each item in array in series | ||
@@ -95,2 +101,4 @@ // return first result from iterator that is not undefined | ||
// aliases | ||
methods.eachSeries = Promise.each; | ||
methods.forEach = Promise.each; | ||
methods.forIn = methods.inSeries; | ||
@@ -97,0 +105,0 @@ methods.forOwn = methods.ownSeries; |
{ | ||
"name": "bluebird-extra", | ||
"version": "0.1.1", | ||
"version": "0.1.3", | ||
"description": "Extra methods for bluebird promises library", | ||
@@ -5,0 +5,0 @@ "main": "./lib/", |
@@ -28,2 +28,6 @@ # bluebird-extra | ||
#### eachParallel() | ||
Like `Promise.each()` but run in parallel. | ||
#### mapSeries() | ||
@@ -91,2 +95,7 @@ | ||
#### each() | ||
##### Aliases: `forEach()`, `eachSeries()` | ||
`Promise.each()` is a native bluebird construct. `forEach()` and `eachSeries()` are aliases for it, included for consistency. | ||
## Tests | ||
@@ -93,0 +102,0 @@ |
12244
174
110