src/await/makeAwaitFunc.js
function thunkToPromise(thunk) {
    return new Promise(function (resolve, reject) {
        var callback = function (err, val) { return (err ? reject(err) : resolve(val)); };
        thunk(callback);
    });
}
function thunkToPromise(thunk) {
    return new Promise(function (resolve, reject) {
        var callback = function (err, val) { return (err ? reject(err) : resolve(val)); };
        thunk(callback);
    });
}
Convert a thunk to a promise.