An operator that converts asynchronous functions expecting a callback to functions returning a Promise.
// Use whatever variable name that you like for the operator
const $P = require('callback-to-promise-operator').default;
// With an asynchronous function expection a callback
const delayUpperCase = (value, callback) => {
setTimeout(() => callback(null, value.toUpperCase()), 1000);
};
// Use it as if it was returning a Promise
delayUpperCase[$P]('string')
.then((result) => {
console.log(result);
});