This repository has been archived by the owner on Dec 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 141
Use the node v8 promisify API to remove unnecessary code #153
Labels
Comments
Yup nice idea, but we need to polyfill it in lower versions. https://github.com/ljharb/util.promisify |
Agreed. I will use this to have a polyfill for node 6.0 - node < v8.0 |
should promisfy once and use the returned function instead of doing it on every invocation. |
ie: const readFileP = util.promisify(fs.readFile); // or whatever
const readFile = (path) => readFileP(path).catch(err => new TemplateError(err)); |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
We can remove some unnecessary explicit
promisify
code by using the v8utils.promisify
API (https://nodejs.org/en/blog/release/v8.0.0/#improved-support-for-promises).E.g.: This function can be changed to a much elegant and declarative implementation.
to
The text was updated successfully, but these errors were encountered: