Skip to content

Instantly share code, notes, and snippets.

@Tomotoes
Last active August 18, 2019 07:47
Show Gist options
  • Save Tomotoes/1cb07df07fdfbe5d9da696ff69c801ca to your computer and use it in GitHub Desktop.
Save Tomotoes/1cb07df07fdfbe5d9da696ff69c801ca to your computer and use it in GitHub Desktop.
Gengrate asynchronous function.
const promisify = callback => (...args) =>
new Promise((resolve, reject) =>
callback(...args, (err, data) => err ? reject(err) : resolve(data))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment