index.js
function mapSeries(fn) {
    var newArray = [];
    // Allow iterator return to be a promise
    function push(value, key) {
        value = fn(value, key);
        if (Q.isPromise(value)) return value.then(function(v) {
            newArray.push(v);
        });
        newArray.push(value);
    }

    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 push(v, key);
            });

            return newPromise.then(function() {
                return push(value, key)
            });
        }, Q());
    }).thenResolve(newArray);
}
function mapSeries(fn) {
    var newArray = [];
    // Allow iterator return to be a promise
    function push(value, key) {
        value = fn(value, key);
        if (Q.isPromise(value)) return value.then(function(v) {
            newArray.push(v);
        });
        newArray.push(value);
    }

    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 push(v, key);
            });

            return newPromise.then(function() {
                return push(value, key)
            });
        }, Q());
    }).thenResolve(newArray);
}
function mapSeries ( fn ) { var newArray = [ ] ; // Allow iterator return to be a promise function push ( value , key ) { value = fn ( value , key ) ; if ( Q . isPromise ( value ) ) return value . then ( function ( v ) { newArray . push ( v ) ; } ) ; newArray . push ( value ) ; } 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 push ( v , key ) ; } ) ; return newPromise . then ( function ( ) { return push ( value , key ) } ) ; } , Q ( ) ) ; } ) . thenResolve ( newArray ) ; }
Transforms an array or object into a new array using the iterator function,
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] : Key of element
@returns {array} Transformed array
Transforms an array or object into a new array using the iterator function running any promises in series only after the last has been completed .