npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@m8t-jacob/validate

v0.1.0

Published

Zero-dependency TypeScript validators for Polish identifiers: NIP, PESEL, REGON, KRS, IBAN/NRB and ID card numbers.

Readme

@m8t-jacob/validate

CI npm version npm downloads bundle size license: MIT

Zero-dependency, fully typed validators for Polish identifiers: NIP, PESEL, REGON, KRS, IBAN/NRB and ID card numbers.

  • Zero runtime dependencies
  • Strict TypeScript, ships dual ESM + CJS builds with .d.ts
  • Tree-shakeable, pure functions — nothing throws
  • Accepts loosely formatted input (spaces, dashes, PL prefixes)
  • Optional Zod adapter (@m8t-jacob/validate/zod)

Install

npm install @m8t-jacob/validate

Quickstart

import { isValidNip, isValidPesel, formatNip } from '@m8t-jacob/validate';

isValidNip('123-456-32-18'); // true
isValidPesel('90010100054'); // true
formatNip('1234563218'); // '123-456-32-18'

API

| Function | Description | | ------------------------------------------------ | --------------------------------------------------------- | | isValidNip(value: string): boolean | Validates a NIP (tax ID) checksum | | isValidPesel(value: string): boolean | Validates a PESEL checksum and embedded birth date | | isValidRegon(value: string): boolean | Validates a 9- or 14-digit REGON checksum | | isValidKrs(value: string): boolean | Validates a KRS (court register) number format | | isValidIbanPl(value: string): boolean | Validates a Polish IBAN or bare NRB (ISO 13616 mod-97) | | isValidIdCard(value: string): boolean | Validates an ID card (dowód osobisty) number checksum | | getPeselBirthDate(pesel: string): Date \| null | Extracts the birth date encoded in a valid PESEL | | getPeselGender(pesel): 'male' \| 'female' \| null | Extracts the gender encoded in a valid PESEL | | normalizeNip(value: string): string | Strips formatting/PL prefix from a NIP | | normalizePesel(value: string): string | Strips formatting from a PESEL | | normalizeRegon(value: string): string | Strips formatting from a REGON | | normalizeKrs(value: string): string | Strips formatting from a KRS number | | normalizeIban(value: string): string | Uppercases and strips formatting from an IBAN/NRB | | normalizeIdCard(value: string): string | Uppercases and strips formatting from an ID card number | | formatNip(value: string): string | Formats a NIP as XXX-XXX-XX-XX |

All isValid* functions accept arbitrarily formatted strings and never throw — invalid or garbage input (including non-string values at runtime) simply returns false.

Zod adapter

Install zod yourself (it's an optional peer dependency) and import from the /zod subpath:

npm install zod
import { z } from 'zod';
import { zNip, zPesel } from '@m8t-jacob/validate/zod';

const schema = z.object({
  nip: zNip(),
  pesel: zPesel({ message: 'Nieprawidłowy numer PESEL' }),
});

schema.parse({ nip: '123-456-32-18', pesel: '90010100054' });

Available schemas: zNip(), zPesel(), zRegon(), zKrs(), zIbanPl(), zIdCard(). Each accepts an optional { message?: string } to override the default bilingual (PL/EN) error message.

🇵🇱 Po polsku

@m8t-jacob/validate to biblioteka bez zależności do walidacji polskich identyfikatorów: NIP, PESEL, REGON, KRS, IBAN/NRB oraz numeru dowodu osobistego. Wszystkie funkcje akceptują dowolnie sformatowany tekst (spacje, myślniki, prefiks PL) i nigdy nie rzucają wyjątków — dla nieprawidłowych danych zwracają false/null. Opcjonalny adapter do Zod (/zod) pozwala łatwo wpiąć walidację w istniejące schematy.

Contributing

Contributions are welcome! See CONTRIBUTING.md for the development workflow and GOOD_FIRST_ISSUES.md for ideas if you're looking for a place to start. This project follows the Contributor Covenant.

License

MIT © 2026 Jakub Jagiełło