index.js
function eachSeries(fn) {
    var i = 0;
    return this.then(function(object) {
        return reduce(object, function(newPromise, value, key) {
            // Allow value to be a promise
            if (Q.isPromise(value)) return newPromise.then(function() {
                return value;
            }).then(function(v) {
                return fn(v, key || i++);
            });

            return newPromise.then(function() {
                return fn(value, key || i++);;
            });
        }, Q())
        .thenResolve(object)
    });
}
function eachSeries(fn) {
    var i = 0;
    return this.then(function(object) {
        return reduce(object, function(newPromise, value, key) {
            // Allow value to be a promise
            if (Q.isPromise(value)) return newPromise.then(function() {
                return value;
            }).then(function(v) {
                return fn(v, key || i++);
            });

            return newPromise.then(function() {
                return fn(value, key || i++);;
            });
        }, Q())
        .thenResolve(object)
    });
}
function eachSeries ( fn ) { var i = 0 ; return this . then ( function ( object ) { return reduce ( object , function ( newPromise , value , key ) { // Allow value to be a promise if ( Q . isPromise ( value ) ) return newPromise . then ( function ( ) { return value ; } ) . then ( function ( v ) { return fn ( v , key || i ++ ) ; } ) ; return newPromise . then ( function ( ) { return fn ( value , key || i ++ ) ; ; } ) ; } , Q ( ) ) . thenResolve ( object ) } ) ; }
Executes function for each element of an array or object, running
any promises in series only after the last has been completed.
@promise {(array|object)}
@param   {function} fn : The function called per iteration
@param value : Value of element
@param key|index : Key if object, index if array
@returns {object} Original object
Executes function for each element of an array or object running any promises in series only after the last has been completed .