This repository was archived by the owner on Mar 31, 2018. It is now read-only.
This repository was archived by the owner on Mar 31, 2018. It is now read-only.
util.toCallback(asyncFn)
- interop of async functions with callbacks. #6
Closed
Description
Similar to #5 I'm looking at ways to make the lives of callback users easier with async/await
landing. I'm wondering if core should provide a method called toCallback
that takes an async function and converts it to a callback returning function. This is similar to asCallback
except taking a function:
async function fooP() {
// some async/await stuff
// ...
return "Hello";
}
const foo = util.toCallback(fooP);
foo((err, data) => console.log(data)); // hello
The name and where it is are both debatable.