rob-util is a NodeJs module I authored for basic common functions that would get shared between various node modules.
var ru = require('rob-util');
This method abstracts the task of throwing an error on a async method.
This is what an standard async throw method will look like typically: function getContact(id, cb) { db.getContact(id, function(err, data) { if(err) throw err; cb(null, data); }); }
This can get reduced to: function getContact(id, cb) { db.getContact(id, ru.cb.callbackThrow(cb)); }
This method abstracts the task of throwing an error on a async method.
This is what an standard async throw method will look like typically: function getContact(id, cb) { db.getContact(id, function(err, data) { cb(err, data); }); }
This can get reduced to: function getContact(id, cb) { db.getContact(id, ru.cb.callbackReturn(cb)); }