lib/altshift/promise.js
function (array) {
            var self = this,
                deferred = new Deferred(),
                fulfilled = false,
                index, length,
                onSuccess = function (value) {
                    if (!fulfilled) {
                        fulfilled = true;
                        deferred.emitSuccess(value);
                    }
                },
                onError = function (error) {
                    if (!fulfilled) {
                        fulfilled = true;
                        deferred.emitSuccess(error);
                    }
                };

            if (!isArray(array)) {
                array = slice.call(arguments);
            }
            for (index = 0, length = array.length; index < length; index += 1) {
                this.when(array[index], onSuccess, onError);
            }
            return deferred.getPromise();
        }
function (array) {
            var self = this,
                deferred = new Deferred(),
                fulfilled = false,
                index, length,
                onSuccess = function (value) {
                    if (!fulfilled) {
                        fulfilled = true;
                        deferred.emitSuccess(value);
                    }
                },
                onError = function (error) {
                    if (!fulfilled) {
                        fulfilled = true;
                        deferred.emitSuccess(error);
                    }
                };

            if (!isArray(array)) {
                array = slice.call(arguments);
            }
            for (index = 0, length = array.length; index < length; index += 1) {
                this.when(array[index], onSuccess, onError);
            }
            return deferred.getPromise();
        }
function ( array ) { var self = this , deferred = new Deferred ( ) , fulfilled = false , index , length , onSuccess = function ( value ) { if ( ! fulfilled ) { fulfilled = true ; deferred . emitSuccess ( value ) ; } } , onError = function ( error ) { if ( ! fulfilled ) { fulfilled = true ; deferred . emitSuccess ( error ) ; } } ; if ( ! isArray ( array ) ) { array = slice . call ( arguments ) ; } for ( index = 0 , length = array . length ; index < length ; index += 1 ) { this . when ( array [ index ] , onSuccess , onError ) ; } return deferred . getPromise ( ) ; }
Takes an array of promises and returns a promise that is fulfilled when the
first promise in the array of promises is fulfilled

@param {Array} array The array of promises
@return {Promise} a promise that is fulfilled with the value of the value of first
promise to be fulfilled
Takes an array of promises and returns a promise that is fulfilled when the first promise in the array of promises is fulfilled