rob-util v0.0.1
rob-util
rob-util is a NodeJs module I authored for basic common functions that would get shared between various node modules.
Status : ALPHA (unstable)
Random
Callback helper
var ru = require('rob-util');
callbackThrow
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)); }
callbackReturn
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)); }
9 years ago