UNPKG

solutasit

Version:

A simple utility to convert NodeJS async functions to native JS promises.

11 lines (10 loc) 237 B
'use strict'; module.exports = function (fun, args, self) { return new Promise(function (resolve, reject) { args.push(function (err, data) { err && reject(err); resolve(data); }) fun.apply(self, args); }); };