Last active
July 16, 2020 17:20
-
-
Save Richienb/b09350e0a6a8dbd75a9dc5bd8f8bd66e to your computer and use it in GitHub Desktop.
Promisify a task
This file contains hidden or 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
module.exports = taskFunction => { | |
return (...arguments_) => module.exports.task(taskFunction(...arguments_)) | |
} | |
module.exports.task = task => new Promise((resolve, reject) => { | |
task.fork(reject, resolve) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment