Skip to content

Latest commit

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Node.js module for parsing and validating postcodes. Country specific validation is supported for most countries including UK, US, Canada, Japan and many others.

Note: I haven't tested all combinations of postcodes for the extended country regular expressions. Please be free to raise a PR with increased test coverage for as many countries possible.

Install

npminstallpostcode-validator

Usage

varpostcode=require('postcode-validator');postcode.validate('W85TT','UK');// returns truepostcode.validate('1234567','UK');// returns false
country codes: US,UK,CA,JP,INT(International),etc

Testing

Run the unit tests with:

npmtest

About

Validate postcodes based on country

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages