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 🙏

© 2024 – Pkg Stats / Ryan Hefner

pesel-validator

v1.0.3

Published

PESEL (Polish personal ID number) validator for java and JS. Library provides both standalone PESEL validation and PESEL validation based on given date of birth and gender.

Downloads

13

Readme

PESEL (Polish personal ID number) validator

This library provides PESEL number validation according to this article. Library lets you check if given PESEL number is valid (may exist) and also if given PESEL number match given gender and date of birth values.

Installation

Library may be installed via npm:

npm install pesel-validator

Library provides one function which can be imported in following way:

import peselValidator from 'pesel-validator';

Usage

To check if given PESEL number is valid you need to call imported function with one string type argument - PESEL number. Returned value is true or false:

const isPeselValid = peselValidator('12345678901');

To check if given PESEL number is valid and match given date you need to call imported function with two arguments - PESEL number and object with key dateOfBirth and value of given date. Given date has to be Date or moment object.

const isPeselValidMoment = peselValidator('12345678901', {dateOfBirth: moment("1983-12-06")});
const isPeselValidDate = peselValidator('12345678901', {dateOfBirth: new Date(1983, 12, 06)});

To check if given PESEL number is valid and match given gender you need to call imported function with two arguments - PESEL number and object with key gender and value of given gender. Allowed values for gender argument are listed below:

  • male, man, m,

  • female, woman, f, w,

  • other, o.

    const isPeselValidShortMale = peselValidator('12345678901', {gender: 'm'}); const isPeselValidLongFemale = peselValidator('12345678901', {gender: 'woman'});

Examples above may be combined:

const isPeselValid = peselValidator('12345678901', {dateOfBirth: moment("1983-12-06"), gender: 'o'});

Java

Library has been implemented in JS and java. Java implementation may be found in a repository root directory.

Walidator numerów pesel [PL]

Biblioteka umożliwia walidację numerów PESEL zgodnie z tym artykułem. Dostępna jest walidacja samego numeru PESEL tzn. czy dany numer PESEL może istnieć i być prawidłowym numerem PESEL. Możliwe jest również sprawdzenie czy dla osoby o danej dacie urodzenia i danej płci podany numer PESEL jest poprawny.

Instalacja

Bibliotekę można zainstalować za pomocą npm:

npm install pesel-validator

Biblioteka udostępnia jedną funkcję, którą można zaimportować w następujący sposób:

import peselValidator from 'pesel-validator';

Użycie

Aby sprawdzić czy PESEL jest prawidłowy należy wywołać funkcję z 1 argumentem typu string - numerem PESEL. Wartością zwróconą będzie true albo false:

const isPeselValid = peselValidator('12345678901'); 

Aby sprawdzić czy numer PESEL jest prawidłowy i odpowiada podanej dacie należy wywołać funkcję z 2 argumentami - numerem PESEL i obiektem z kluczem dateOfBirth i wartością podanej daty. Dozwolone jest podanie daty jako obiektu klasy Date lub obiektu klasy moment.

const isPeselValidMoment = peselValidator('12345678901', {dateOfBirth: moment("1983-12-06")});
const isPeselValidDate = peselValidator('12345678901', {dateOfBirth: new Date(1983, 12, 06)});

Aby sprawdzić czy numer PESEL jest prawidłowy i odpowiada podanej płci należy wywołać funkcję z 2 argumentami - numerem PESEL i obiektem z kluczem gender i wartością podanej płci. Dozwolone wartości dla płci to:

  • male, man, m dla płci męskiej,

  • female, woman, f w dla płci żeńskiej,

  • other, o dla płci innej.

    const isPeselValidShortMale = peselValidator('12345678901', {gender: 'm'}); const isPeselValidLongFemale = peselValidator('12345678901', {gender: 'woman'});

Powyższe przykłady można połączyć tzn. sprawdzić PESEL dla daty i płci:

const isPeselValid = peselValidator('12345678901', {dateOfBirth: moment("1983-12-06"), gender: 'o'});

Java

Biblioteka została zaimplementowana w JS i javie. Wersję dla javy można znaleźć w głównym katalogu repozytorium pod tym linkiem.