How do you implement a function that takes a function following the common error-first callback style and returns a version that returns promises?

Technical