An open API service indexing awesome lists of open source software.

https://github.com/radarsu/validate-polish

Utility library for validation of PESEL, NIP, REGON, identity card etc. Aimed mostly at Polish enviroment. [Polish] Walidacja numerów pesel, nip, regon, dowodu osobistego.
https://github.com/radarsu/validate-polish

identity-card identity-card-validation identitycard javascript javascript-library nip node nodejs nodejs-library pesel pesel-validation polish polish-language polski polskie regon regon-validation typescript typescript-library validation-library

Last synced: 2 months ago
JSON representation

Utility library for validation of PESEL, NIP, REGON, identity card etc. Aimed mostly at Polish enviroment. [Polish] Walidacja numerów pesel, nip, regon, dowodu osobistego.

Awesome Lists containing this project

README

        


validate-polish


Utility library for validation of PESEL, NIP, REGON, and identity card numbers. Aimed mostly at the Polish environment.

[Polish] Walidacja numerów PESEL, NIP, REGON, oraz dowodu osobistego.

[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/radarsu)

## Table of contents

1. [Getting Started](#getting-started)

2. [Usage](#usage)

3. [Features](#features)

## Getting Started
`npm i validate-polish`

## Usage
### General

```ts
import { validatePolish } from 'validate-polish';

if (!validatePolish.pesel(`92060512181`)) {
throw new Error(`Invalid pesel.`);
}

if (!validatePolish.nip('115667734')) {
throw new Error(`Invalid nip.`);
}

if (!validatePolish.regon(`1251677`)) {
throw new Error(`Invalid regon.`);
}

if (!validatePolish.identityCard(`14124142`)) {
throw new Error(`Invalid identity card.`);
}
```

### Browser

In browser validate-polish package is wrapped twice `validatePolish.validatePolish`.

```html

console.log(validatePolish.validatePolish);

```

## Features
- **CDN** - available via cdn (https://cdn.jsdelivr.net/npm/validate-polish@latest/dist/index.browser.js)
- **Cross-platform** - works in Node.js, browser and with bundlers such as webpack
- **Fast, lightweight, 0 dependencies** - no dependencies ensure there are no security breaches from other packages
- **Maintained** - if you need additional functionality feel free to create PR or an Issue
- **Strongly typed** - library written fully in TypeScript
- **Supports PESEL, REGON (9 and 14), NIP, IDENTITY CARD** - also validates day and month correctness including century encoded in month.
- **Tested** - has tests on dozens of valid and invalid chunks of data to make sure validations are performed flawlessly