dependon
A node.js module for easily enforcing correct arguments
dependon is simply a wrapper of sorts in order to make checking arguments and throwing errors look cleaner. dpendon takes advantage of higher order functions in order to check arguments. The node.js module, functioner is recommended, but you are free to use whichever library you like best.
Installation
$ npm install dependon
Usage
var dependon = ;var being = assert;
// without dependon { if typeof x !== 'number' throw 'x should be a positive number'; if x <= 0 throw 'x should be a positive number'; return Math;} // with dependon and functioner { ; return Math;}
dependon is really just a function that takes a value as its first parameter, as many functions as you want next, and lastly a string for the error message, and optionally an error type after the message.
// using just dependon;
functioner makes dependon a lot more powerful with its ability to build functions to call on the value in order to assert it.
// more complex usage of functionervar f = assert; ;;;