thunk
const Thunk = function(fn) {
return function (...args) {
return function (callback) {
return fn.call(this, ...args, callback);
}
};
};
function f(a, cb) {
cb(a);
}
const ft = Thunk(f);
console.log(ft)
ft(2)(console.log) // 2