Skip to content

Instantly share code, notes, and snippets.

@yujintang
Created March 9, 2018 10:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yujintang/db020b4a50de15c8053200c888eca6c2 to your computer and use it in GitHub Desktop.
Save yujintang/db020b4a50de15c8053200c888eca6c2 to your computer and use it in GitHub Desktop.
const promisify = require('util').promisify;
module.exports = function promisifyAll(obj) {
for(const key in obj){
if(obj.hasOwnProperty(key)){
obj[key + 'Async'] = promisify(obj[key]);
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment