Created
January 13, 2022 01:47
-
-
Save crutchcorn/8cdb0a7b2231cbd1bc216e4a780716be 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) => { | |
return (...args) => { | |
return new Promise(resolve => { | |
fn(...args, (...data) => resolve(...data)) | |
}) | |
} | |
} | |
promisify((one, cb) => cb(one))(1).then(one => console.log(one)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment