1.0.4 • Published 5 years ago

pesel-utils v1.0.4

Weekly downloads
28
License
MIT
Repository
github
Last release
5 years ago

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