Skip to content

Latest commit

 

History

History
59 lines (40 loc) · 1.27 KB

README.md

File metadata and controls

59 lines (40 loc) · 1.27 KB

JMBG

JMBG is a tiny utility tool for managing Unique Master Citizen Number for citizens of Bosnia, Serbia, Slovenia and North Macedonia.

It supports ESM, CommonJS, and it has typescript types included.

Installation

npm install jmbg

Usage

import { isValidJMBG, decodeJMBG, generateRandomJMBG } from "jmbg";

isValidJMBG('2206978816007') // true

decodeJMBG('2206978816007')
/*
{ 
    year: 1978,
    month: 6,
    day: 22,
    gender: 'Female',
    region: 'Vojvodina',
    place: 'Sombor'
}
*/
generateRandomJMBG() // '2005006982505' (generates random valid JMBG)

or using CommonJS

const jmbg = require('jmbg');

jmbg.isValidJMBG('2206978816007')
jmbg.decodeJMBG('2206978816007')
jmbg.generateRandomJMBG()

Sources

Contribution

Feel free to contribute!

Fork the project, make your own branch with a new feature, after it's done create a PR on this repo.

For testing, use npm run test or yarn test.