-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
whilst crashes if callback function is not given #446
Comments
I agree that there is a natural use case for not using the callback. Two reasons I don't think it should be allowed though:
I suppose that those are the same issue. Thoughts? Sent from my Samsung Galaxy S®4 -------- Original message -------- Following code var async = require('async'); /home/hayashis/git/osg-blast/node_modules/async/lib/async.js:627 — |
Humm really? I am really surprised. All callback functions should be optional unless it's absolutely needed (I can't think of any such case, however). For example, all (as far as I know) callback functions given to node's fs package are optional. You can do something like...
or
It might look odd, but maybe user just wants to see if fs.readFile will throw any exception? Who knows. In case of async.whilst, it is perfectly normal that no post-loop processing is needed. I strongly recommend that you make the last callback function optional to make it more consistent with the rest of the standard node libraries. |
Following code
Will results in
If I don't need to do anything after the loop, it's natural to assume that I should be able to not supply any callback function.
The text was updated successfully, but these errors were encountered: