3.8.20 • Published 8 months ago

postcode-validator v3.8.20

Weekly downloads
8,628
License
MIT
Repository
github
Last release
8 months ago

postcode-validator

Commitizen friendly

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

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

Install

npm install postcode-validator

Usage

// commonjs
const { postcodeValidator, postcodeValidatorExistsForCountry } = require('postcode-validator');
// ES6
import { postcodeValidator, postcodeValidatorExistsForCountry } from 'postcode-validator';

postcodeValidator('W85TT', 'GB'); // returns true
postcodeValidator('1234567', 'GB'); // returns false

postcodeValidatorExistsForCountry('GB'); // returns true
postcodeValidatorExistsForCountry('Moon'); // returns false

country codes: US, GB, CA, JP, INTL(International), etc

Testing

Run the unit tests with:

npm test

Conventional Commits

Commit code using below npm script or just follow conventional commits for commit messages using git commit.

npm run commit
3.8.16

8 months ago

3.8.17

8 months ago

3.8.15

8 months ago

3.8.18

8 months ago

3.8.19

8 months ago

3.8.20

8 months ago

3.8.14

9 months ago

3.8.12

10 months ago

3.8.13

9 months ago

3.8.10

11 months ago

3.8.11

11 months ago

3.8.9

11 months ago

3.8.4

11 months ago

3.8.3

11 months ago

3.8.2

11 months ago

3.8.1

11 months ago

3.8.8

11 months ago

3.8.7

11 months ago

3.8.6

11 months ago

3.8.5

11 months ago

3.8.0

1 year ago

3.7.0

2 years ago

3.6.6

2 years ago

3.6.5

2 years ago

3.6.0

2 years ago

3.5.3

3 years ago

3.5.2

3 years ago

3.4.2

3 years ago

3.5.0

3 years ago

3.3.1

3 years ago

3.3.0

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.1.1

3 years ago

3.1.0

4 years ago

3.0.0

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.2.1

5 years ago

1.2.0

9 years ago

1.1.6

9 years ago

1.1.5

9 years ago

1.1.4

9 years ago

1.1.3

9 years ago

1.1.2

9 years ago

1.1.0

9 years ago

1.0.12

9 years ago

1.0.11

9 years ago

1.0.10

9 years ago

1.0.9

9 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago