node-validate
This provides a simple is<Type> and assert<Type> module for Node.js. Typically these are used as validators, either for parameter testing or in unit test code.
Install
The usual, npm, add a dependency in your package.json to
validate-type
and run:
$ npm install
API
The module provides very basic isType
and assertType
functions for testing. All predicates return boolean values, all assertions
either return nothing or throw an AssertionError.
var Validate = ; Validate; // trueValidate; // false; Validate; // nothingValidate; // Error
Currently the following types are supported:
- NullOrUndefined
- String
- Number
- Integer
- Float
- Boolean
- Date
- Array
- Function
Examples
TBD