Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xxczaki/pesel-utils
Bunch of utilities useful when working with PESEL numbers
https://github.com/xxczaki/pesel-utils
date gender node nodejs npm package pesel pesel-number pesel-utils pesel-validation pesel-validator polish polska types typescript utilities utility utils validate validation
Last synced: 2 months ago
JSON representation
Bunch of utilities useful when working with PESEL numbers
- Host: GitHub
- URL: https://github.com/xxczaki/pesel-utils
- Owner: xxczaki
- License: mit
- Created: 2019-08-01T14:57:31.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-26T12:49:52.000Z (about 2 years ago)
- Last Synced: 2024-11-11T20:51:40.662Z (3 months ago)
- Topics: date, gender, node, nodejs, npm, package, pesel, pesel-number, pesel-utils, pesel-validation, pesel-validator, polish, polska, types, typescript, utilities, utility, utils, validate, validation
- Language: TypeScript
- Size: 13.7 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: license
Awesome Lists containing this project
README
# Pesel Utils
> Bunch of utilities useful when working with PESEL numbers
[![Build Status](https://travis-ci.org/xxczaki/pesel-utils.svg?branch=master)](https://travis-ci.org/xxczaki/pesel-utils)
[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo)
[![install size](https://packagephobia.now.sh/badge?p=pesel-utils)](https://packagephobia.now.sh/result?p=pesel-utils)## 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
```js
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](https://www.iso.org/iso-8601-date-and-time-format.html) format).
##### pesel
Type: `string`
PESEL you want to check.
## License
MIT © [Antoni Kepinski](https://kepinski.me)