joi-postcode
v3.0.0
Published
Postcode validation via regex for Joi
Downloads
42
Maintainers
Readme
joi-postcode
Validate UK postcodes with Joi.
This is a regex based validation taken from the excellent postcode.js. Note that this will just check the format of the given string is correct, not that the postcode exists. See note on postcode validation.
Usage
var Joi = require('joi').extend(require('joi-postcode'))
Joi.postcode().validate('WC2N 4HG', function (err) {
console.log(err ? 'Invalid' : 'Valid')
})