Is there a naming convention for the name of the callback function you pass to async methods in node.js? I've seen a number of different names used and I generally pick a name that makes sense in the given context.
Has a convention emerged?
I think there are no general naming convention. I use a normal speaking name in camelCase. My co-worker prefers the Callback
postfix like handleUserListCallback
. My other co-worker prefers the Handler
postfix and another prefers the __ (double underscore) prefix (yes he was a python believer).
For naming the variable: Name it clearly.
function fetch(parameter, callback) {}
function worker(parameter, done) {}
function job(parameter, finish) {}
Try to use an understandable naming. One that you can understand and other who tries to read or improve your code and be consequent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With