hybrid-callback - A very simple node.js hybrid callback pattern library
What is it
Node.js has the async programming model. Most of the function calls have the last parameter as a callback parameter, which is a function reference. Usually you have to deal with each callback's error/success state, this duplicates code a lot and creates the callback hell.
There are different options to deal with callbacks including promises. hybrid-callback is a very simple pattern where you wrap the callback with a function call. Wraping the callback will allow you to write your code for success states only and error states will bubble up as needed.
Getting started
$ npm install --save hybrid-callback
Usage
Instead of writing
{ ;}
Write
const hcb = ; { ;}
License
hybrid-callback is licensed under the MIT.
Changelog
- 1.0.0: Initial version (simplified from cb-result library)