joi-postcode

3.0.0 • Public • Published

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')
})

Package Sidebar

Install

npm i joi-postcode

Weekly Downloads

25

Version

3.0.0

License

ISC

Last publish

Collaborators

  • alanshaw