⚠️ Package no longer maintained. I recommend using a more well-maintained package, such aspostcode-validator
.
Check if a zip/postal code is valid
$ npm install --save is-valid-zipcode
var isValidZipcode = require('is-valid-zipcode');
isValidZipcode('2000-000', 'PT');
// => true
isValidZipcode('7521785-952-520', 'PT');
//=> false
By default, the country is United States.
MIT © Henrique Dias