perambulate
v1.0.1
Published
A simple function parameter validator
Downloads
2
Readme
perambulate
Simple function parameter validation for node.js.
Very simple variable validation. Simply pass an array of objects to parambulate and it will barf at the first one that breaks it.
Checks for array, object, number, string, boolean, null, undefined,function
Example call that validates
var name="Jethro Q. Walrustitty";
var votes=32108;
var result = perambulate([{'string':name},{'number':votes}]);
//result.failed_parameter === {}
//result.is_valid === true
Example call that doesn't validate
var name="Kevin Phillips-Bong";
var votes="fish";
var result = perambulate([{'string':name},{'number':votes}]);
//result.failed_parameter === {'number':votes};
//result.is_valid === false