Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 1.19 KB

README.md

File metadata and controls

34 lines (26 loc) · 1.19 KB

Build Status Coverage Status npm version

postal-codes.js

Provide javascript postal code validation for all countries.

Validation rules

  1. Characters " " (space) and "-" (dash) are removed from the passed string
  2. Case doesn't matter

Testing with mocha

$ npm test
$ npm run coverage

Usage

var postalCodes = require('postal-codes-js');

// All the calls below returns true
postalCodes.validate('bg', '1003');
postalCodes.validate('gb', 'EC1A 1BB');
postalCodes.validate('gb', 'EC1A1BB');
postalCodes.validate('gb', 'EC1A-1BB');
postalCodes.validate('tr', '33150');
postalCodes.validate('us', '22313');

Contribution

Contributions are more than welcome, just fork the repo and create a pull-request ;)

Contact

[email protected]