range-validator
v0.0.2
Published
Simple but configurable range validator for node
Downloads
4
Readme
Range Validator
Simple function for specifying range validation in node. Currently this is just a little project for me to work on while I'm up feeding the baby at 3am. Features will increase in line with sleepless nights. One day it might be useful.
Example
var RangeValidator = require('range-validator');
var rangeValidator = new RangeValidator({ min: 1, max: 3});
rangeValidator.validate(1);
// { valid: true, errors: [] }
rangeValidator.validate(20);
// { valid: false, errors: ['value exceeds maximum range']}
API
Available options are as follows
min
the minimum a value may bemax
the maximum a value may be
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request