tooling TypeScript maintained library
validate-polish
Validators for Polish identifiers — PESEL, NIP, REGON, ID cards — that actually pass the checksum tests.
Why
Every time I needed to validate a PESEL or NIP in Node, I’d search npm and find three packages that all had the same subtle bug: they validated the format but not the checksum, or they implemented the checksum wrong for edge cases (century bits in PESEL, weighted sums in NIP, the 9- vs 14-digit REGON variants).
validate-polish ships correct implementations for:
- PESEL — including date-of-birth extraction and century decoding (1800s through 2200s)
- NIP — weighted-sum checksum with the correct multipliers
- REGON — both 9-digit and 14-digit variants
- ID card number (dowód osobisty) — old and new format
Every validator has tests. If you find a case that breaks, open an issue with the specific number — it’ll get fixed.
Install
npm install validate-polish