jmbg
TypeScript icon, indicating that this package has built-in type declarations

2.1.1 • Public • Published

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.

Package Sidebar

Install

npm i jmbg

Weekly Downloads

321

Version

2.1.1

License

ISC

Unpacked Size

21.8 kB

Total Files

6

Last publish

Collaborators

  • dedadev