Added Entity and Entity Reference Revisions which got dropped somewhere along the...
[yaffs-website] / node_modules / bluebird / js / release / each.js
1 "use strict";
2 module.exports = function(Promise, INTERNAL) {
3 var PromiseReduce = Promise.reduce;
4 var PromiseAll = Promise.all;
5
6 function promiseAllThis() {
7     return PromiseAll(this);
8 }
9
10 function PromiseMapSeries(promises, fn) {
11     return PromiseReduce(promises, fn, INTERNAL, INTERNAL);
12 }
13
14 Promise.prototype.each = function (fn) {
15     return this.mapSeries(fn)
16             ._then(promiseAllThis, undefined, undefined, this, undefined);
17 };
18
19 Promise.prototype.mapSeries = function (fn) {
20     return PromiseReduce(this, fn, INTERNAL, INTERNAL);
21 };
22
23 Promise.each = function (promises, fn) {
24     return PromiseMapSeries(promises, fn)
25             ._then(promiseAllThis, undefined, undefined, promises, undefined);
26 };
27
28 Promise.mapSeries = PromiseMapSeries;
29 };