
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
postcode-validator
Advanced tools
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.
npm install postcode-validator
// 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
Run the unit tests with:
npm test
Commit code using below npm script or just follow conventional commits for commit messages using git commit.
npm run commit
FAQs
Validate postcodes based on country
The npm package postcode-validator receives a total of 148,002 weekly downloads. As such, postcode-validator popularity was classified as popular.
We found that postcode-validator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.