Created
March 9, 2018 10:17
-
-
Save yujintang/db020b4a50de15c8053200c888eca6c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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