src/promises.js
function resolve(promiseLike) {

    // Return if already promised
    if (promiseLike instanceof Promise) {
        return promiseLike;
    }

    var promises = [];

    if (promiseLike instanceof Array) {
        promiseLike.forEach((promiseLikeEntry) => {
            promises.push(promisify(promiseLikeEntry));
        });
    }
    else if (promiseLike && (typeof promiseLike === "object")) {
        Object.keys(promiseLike).forEach((key) => {
            promises.push(promisify(promiseLike[key]));
        });
    }
    else {
        return promisify(promiseLike);
    }

    return Promise.all(promises).then((result) => {
        if (promiseLike instanceof Array) {
            return result;
        }

        var response = {};
        Object.keys(promiseLike).forEach((key, index) => {
            response[key] = result[index];
        });

        return response;
    });
}
function resolve(promiseLike) {

    // Return if already promised
    if (promiseLike instanceof Promise) {
        return promiseLike;
    }

    var promises = [];

    if (promiseLike instanceof Array) {
        promiseLike.forEach((promiseLikeEntry) => {
            promises.push(promisify(promiseLikeEntry));
        });
    }
    else if (promiseLike && (typeof promiseLike === "object")) {
        Object.keys(promiseLike).forEach((key) => {
            promises.push(promisify(promiseLike[key]));
        });
    }
    else {
        return promisify(promiseLike);
    }

    return Promise.all(promises).then((result) => {
        if (promiseLike instanceof Array) {
            return result;
        }

        var response = {};
        Object.keys(promiseLike).forEach((key, index) => {
            response[key] = result[index];
        });

        return response;
    });
}
function resolve ( promiseLike ) { // Return if already promised if ( promiseLike instanceof Promise ) { return promiseLike ; } var promises = [ ] ; if ( promiseLike instanceof Array ) { promiseLike . forEach ( ( promiseLikeEntry ) => { promises . push ( promisify ( promiseLikeEntry ) ) ; } ) ; } else if ( promiseLike && ( typeof promiseLike === "object" ) ) { Object . keys ( promiseLike ) . forEach ( ( key ) => { promises . push ( promisify ( promiseLike [ key ] ) ) ; } ) ; } else { return promisify ( promiseLike ) ; } return Promise . all ( promises ) . then ( ( result ) => { if ( promiseLike instanceof Array ) { return result ; } var response = { } ; Object . keys ( promiseLike ) . forEach ( ( key , index ) => { response [ key ] = result [ index ] ; } ) ; return response ; } ) ; }
Resolves one or more promise-likes

@param {*} promiseLike
@returns {Promise}
Resolves one or more promise - likes