lib/utils/promises.js
function (visit, onFail, opts) {
        var fail = onFail ? onFail : utils.ret(false),
            config = opts || { compact: true };

        return function (list) {
            var p = Promise.resolve(false),
                results = [];

            list.forEach(function (l, i) {
                p = p.then(visit.bind(null, l))
                    .catch(function (err) {
                        return fail(err, l);
                    })
                    .then(function (result) {
                        results.push(result);
                        if(config.onProgress) config.onProgress(list.length, i + 1, l);
                    });
            });

            return p.then(function () {
                return config.compact ? results.filter(Boolean) : results;
            });
        };
    }
function (visit, onFail, opts) {
        var fail = onFail ? onFail : utils.ret(false),
            config = opts || { compact: true };

        return function (list) {
            var p = Promise.resolve(false),
                results = [];

            list.forEach(function (l, i) {
                p = p.then(visit.bind(null, l))
                    .catch(function (err) {
                        return fail(err, l);
                    })
                    .then(function (result) {
                        results.push(result);
                        if(config.onProgress) config.onProgress(list.length, i + 1, l);
                    });
            });

            return p.then(function () {
                return config.compact ? results.filter(Boolean) : results;
            });
        };
    }
Executes a function as a promise for every item in a list.

@param visit {function} the function to execute
@param onFail {function} error callback
@param opts {{}} options for setting progress listener or compactness
@returns {Promise.<[]>} results from function