0.1.0 • Published 10 years ago
assert-cb v0.1.0
assert-cb
Assert that calls a function with an error instead of throwing it if the assert fails.
var assert = require('assert-cb')
function doStuff(opts, cb) {
if (!assert(opts.day, 'need to provide day', cb)) return;
if (!assert(opts.hour, 'need to provide hour', cb)) return;
// determine result
[..]
cb(null, res);
}
Installation
npm install assert-cb
generated with docme
License
MIT
0.1.0
10 years ago