Skip to content

Instantly share code, notes, and snippets.

@davidbarral
Created January 20, 2018 16:12
Show Gist options
  • Save davidbarral/c728fddbc5db941769939ec3e65e83b0 to your computer and use it in GitHub Desktop.
Save davidbarral/c728fddbc5db941769939ec3e65e83b0 to your computer and use it in GitHub Desktop.
Callbackify: node callbackify
const { callbackify } = require("util");
const evenSuccess = n => n % 2 ? Promise.reject("odd") : Promise.resolve("even");
callbackify(evenSuccess)(1, console.log); // "odd"
callbackify(evenSuccess)(2, console.log); // undefined "even"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment