Live data from Hacker News

Node v7.5.0 Released

github.com

41–50 of 142 posts

Re: Node v7.5.0 Released

#41
post #3

There is a lot to like about Node. I had a look a couple of years ago but lack of a definitive library to handle callback hell put me off. How is the situation these days?

We've been using async/await (transpiled with babel) for last one year in our production API code. There really is not any need to use those async control flow libraries anymore.

Re: Node v7.5.0 Released

#44
post #37

Earlier quoted context omitted.

> lack of a definitive library to handle callback hell put me off. 1) Promises. 2) Caolan's async is wonderful for handling all sorts of 'async' problems, like async map and stuff. As close as a de facto library as you can get.

The standard library is still callback hell and the async package doesn't use promises at all.

Promises have been native in node for awhile, so any time you spend in callback hell is entirely your prerogative.

Re: Node v7.5.0 Released

#45
post #36

Earlier quoted context omitted.

Also highly recommend the npm async library[1] even though the hipster way is now native async/wait or promises. caolan/async has some amazing sugar on nearly every use-case the most common for me being async.auto(). [1] https://github.com/caolan/async

I highly recommend against using that library - it encourages a lot of callback hell we've found at my company, and it is much harder to create nice reusable functions with it vs. promises. bluebird is a wholly superior library for handling async flow.

So much of the promise-based code I see looks almost the same as it would with plain callbacks, just with the callbacks plopped into .then(). Am I missing something? How do promises make for more reusable functions?

Re: Node v7.5.0 Released

#46
post #3

There is a lot to like about Node. I had a look a couple of years ago but lack of a definitive library to handle callback hell put me off. How is the situation these days?

Many people are complaining that the standard library still uses callbacks and so even though you have async/await, you can't use it with the standard library.

I wholeheartedly agree. I don't understand why someone hasn't build a compat library that simply promisifies all the standard library (it isn't that big), taking the edge cases into account.

Re: Node v7.5.0 Released

#47

Earlier quoted context omitted.

You have a number of ways of keeping a handle on async code now. 1. Native ES6 promises will cover most of your basic needs. See https://developer.mozilla.org/en/docs/Web/JavaScript/Referen... . In fact, unless you have very specific needs not covered by native promises, you shouldn't drop a third party library into your project. 2. For more advanced operations on promises, use Bluebird. See http://bluebirdjs.com and…

My understanding was that Node didn't support native ES6, is that no longer the case? Or are you talking about using a transpiler?

A year or two ago that was the case. Then io.js forked, implemented a bunch of features and later was brought back into the NodeJS fold. Since then, Node has been a lot more proactive about keeping up with newer specs.

Re: Node v7.5.0 Released

#48
post #44
post #37

Earlier quoted context omitted.

The standard library is still callback hell and the async package doesn't use promises at all.

Promises have been native in node for awhile, so any time you spend in callback hell is entirely your prerogative.

Wrapping every standard library method with my own promises sounds like just another flavour of hell, and it still doesn't address the fact that the standard library is callback hell.

Re: Node v7.5.0 Released

#49
post #36

Earlier quoted context omitted.

I highly recommend against using that library - it encourages a lot of callback hell we've found at my company, and it is much harder to create nice reusable functions with it vs. promises. bluebird is a wholly superior library for handling async flow.

So much of the promise-based code I see looks almost the same as it would with plain callbacks, just with the callbacks plopped into .then(). Am I missing something? How do promises make for more reusable functions?

You can take the part before `.then()` and pass it around.

Re: Node v7.5.0 Released

#50
post #46
post #3

There is a lot to like about Node. I had a look a couple of years ago but lack of a definitive library to handle callback hell put me off. How is the situation these days?

Many people are complaining that the standard library still uses callbacks and so even though you have async/await, you can't use it with the standard library. I wholeheartedly agree. I don't understand why someone hasn't build a compat library that simply promisifies all the standard library (it isn't that big), taking the edge cases into account.

There are like 10 of those, fwiw.
Post reply on HN