Created
June 25, 2018 11:30
-
-
Save jportella93/cf89f1cac0f631317d0ba8ec94aedf12 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 = (fn) => (...args) => new Promise((resolve, reject) => { | |
fn.apply(insight, [...args, (err, ...args) => { | |
if (err) return reject(err); | |
resolve.apply(this, args); | |
}]); | |
}); | |
// example: | |
// insight.getUnspentUtxosPromise = promisify(insight.getUnspentUtxos); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment