customs

Type validator for node.js and the browser through browserify

customs

Type validator for node.js and the browser through browserify.

With node installed:

npm i --save customs
var validate = require('customs');
 
validate('string', 'Dad jokes');
// -> 'true' 
 
validate('string', 1337);
// -> 'false' 
 
validate(/d(b+)d/g, 'cdbbdbsbz');
// -> 'true' 
  • array
  • string
  • number
  • boolean
  • object
  • email
  • any RegExp

Date-time types are not supported because there's too much variation. Just provide your own definition as a RegExp.

MIT © Yoshua Wuyts