📅  最后修改于: 2022-03-11 15:01:41.112000             🧑  作者: Mango
function promisify(func, callbackPos=null) {
return (...args) => {
return new Promise((resolve) => {
const cb = (...args) => {
resolve(args);
};
args.splice(callbackPos != null ? callbackPos : args.length, 0, cb);
func(...args);
});
};
};