📌  相关文章
📜  node promisify without err - Javascript代码示例

📅  最后修改于: 2022-03-11 15:01:20.196000             🧑  作者: Mango

代码示例1
function promisify(func, callbackPos) {
  return (...args) => {
    return new Promise((resolve) => {
      const cb = (...args) => {
        resolve(args);
      };
      args.splice(callbackPos ? callbackPos : args.length, 0, cb);
      func(...args);
    });
  };
};