src/util/promise-util.js
function Q_chainmap (args, func) {
    return Promise.resolve().then(function (inValue) {
        return args.reduce(function (soFar, arg) {
            return soFar.then(function (val) {
                return func(arg, val);
            });
        }, Promise.resolve(inValue));
    });
}
function Q_chainmap (args, func) {
    return Promise.resolve().then(function (inValue) {
        return args.reduce(function (soFar, arg) {
            return soFar.then(function (val) {
                return func(arg, val);
            });
        }, Promise.resolve(inValue));
    });
}
Given a function and an array of values, creates a chain of promises that will sequentially execute func(args[i]). Returns a promise.