code: function wrap(func, scope) {
    return function (...args) {
      if (args.length) {
        const temp = args.pop()
        if (typeof temp !== 'function') {
          args.push(temp)
        }
      }
  
      return new Promise(function (resolve, reject) {
        args.push(function (err, data) {
          if (err) reject(err)
          else resolve(data)
        })
  
        func.apply((scope || null), args)
      })
    }
  }
docs: 异步函数封装