A simple JavaScript validation library that doesn't interfere
time
Checks if the value is a valid string representing time in a 24 hour format (hh:mm:ss).
Parameters: none
Result: default
Message: '{title} is not a valid time'
var rule = {
time: true
};
var result = approve.value('12:25:30', rule);
date
Checks if the value is a valid string representing a date (YYYY[/-]MM[-/]DD).
Parameters: none
Result: default
Message: '{title} is not a valid date'
var rule = {
date: true
};
var result = approve.value('2016-10-01', rule);
truthy
Checks if the value is truthy ('Yes', '1', 'true', 'ok[ay]').
Parameters: none
Result: default
Message: '{title} is not valid'
var rule = {
truthy: true
};
var result = approve.value('Yes', rule);
falsy
Checks if the value is not truthy ('No', '0', 'false').
Parameters: none
Result: default
Message: '{title} is not valid'
var rule = {
falsy: true
};
var result = approve.value('No', rule);
Improved range
. Now checks both string length and number value.
Improved IP test - now also supports CIDR notation
Improved credit card test - Now using Luhn algorithm.
strength
test result properties to make more sense.strength
test result properties from nested score
object to
root of result.Please read upgrade guide.
Improved cyclomatic complexity down to 8 Leaner methods Added gulp-jshint for linting
Added mocha for testing and removed jsmine Added to Travis-CI Published Node.js package
Updated documentation Updated comments Removed old configure method Added test config handling
Improved error message formatting Commented all code Added JSDoc documentation