Hacker News new | past | comments | ask | show | jobs | submit login

> 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.


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.


Callback hell isn't the characteristic of having a callback-based API. It's the code you get when you try to compose it and conditionally fork it without any better abstractions.

So promisifying a callback-based API does address it by either letting you use a yield/await abstraction or at the very least promise composition.

Wrapping a callback-based API is such a mechanical process that you can wrap entire modules at a time, so I'm not sure what's hellish about that when it gives you promises, something you can actually work with.


I agree with you but FWIW there are both big (Bluebird) and small (pinky-promise) packages to promisify stuff.


promise-ring is one library that does the wrapping automatically from node-style callbacks to promises. I think Bluebird also has an auto-wrapper.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: