Promisify
Promisify converts a function that takes a callback into a function that takes a callback or returns a promise.
Installation
npm install promisify-optional-callback
Usage
const promisify = ; { console; ;} const examplePromise = ; ; // OR ;
If callback
is called with a non-null object as its first argument, that is handled as an error and the promise will reject.