Skip to content

Bunch of utilities useful when working with PESEL numbers

License

Notifications You must be signed in to change notification settings

xxczaki/pesel-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pesel Utils

Bunch of utilities useful when working with PESEL numbers

Build Status XO code style install size

Highlights

  • Simple API
  • 0 dependencies
  • Well tested
  • Uses 4-step PESEL validation (lenght + year + month + checksum)
  • Written in TypeScript

Install

$ npm install pesel-utils

Usage

const {isValidPesel, checkGender, getDateOfBirth} = require('pesel-utils');

isValidPesel('371340514609'); //=> false
checkGender('69021818876'); //=> 'male'
getDateOfBirth('75040373939'); //=> '1975/04/03'

API

isValidPesel(pesel)

Returns a boolean of whether the provided PESEL is valid or not.

pesel

Type: string

PESEL you want to check.

checkGender(pesel)

Returns a string with gender (male or female).

pesel

Type: string

PESEL you want to check.

getDateOfBirth(pesel)

Returns a string with date of birth, extracted from PESEL (in ISO 8601 format).

pesel

Type: string

PESEL you want to check.

License

MIT © Antoni Kepinski