Re:Node v7.5.0 Released
by athenot on Friday February 03, 2017 @10:22AM
(#13560339)
This is probably not the answer you're looking for, but you could look into ways that make callbacks enjoyable. The syntactic sugar provided by CoffeeScript goes a long way to make readable (and, dare I say, elegant) what would be a tangled mess in straight up JavaScript:
5 callbacks here but they don't impede readability.
[ Parent
| on HN ]
Maybe it's just me, but this would look infinitely more readable to me if I could tell where each callback starts and where it ends, i.e. in plain JavaScript.
Re:Node v7.5.0 Released
by always_good on Friday February 03, 2017 @11:05AM
(#13560732)
What impedes readability here is that you don't simply have an async function `getProfiles({ userId })` that gives you a list of profiles, either taking a callback or returning a promise.
A lot of that is pointless noise. You don't need to set the status code to 200 or call end(). `res.json(profiles)` will do.
And these days, Coffeescript is just Javascript with some optional parens. Can't think of many upsides in 2017 to not just using ES6.