Oib.js

OIB validator

View the Project on GitHub andreicek/oib.js

OIB.js - Simple OIB validation

Build Status

What is OIB?

OIB is Osobni identifikacijski broj (eng. Personal identification number); a uniq numerical identificator of companies and people in Republic of Croatia. It's in use since 2009.

Usage

Install it with npm:

npm install --save oib.js

And use it like:

const oib = require('oib.js');

oib.validate('24076340234');

Or include it in your HTML (1995 style):

<script src="https://unpkg.com/oib.js"></script>

And use it like:

oib.validate('24076340234');

Methods

validate(1)

This will validate against the full specification of the standard. It accepts both string and number. It returns true or false.

oib.validate('24076340234');
oib.validate(24076340234);

iso7064(1)

This validates only against ISO 7064 standard (it just exposes the ISO 7064 algorithm). It accepts both string and number. It returns true or false.

oib.iso7064('24076340234');
oib.iso7064(24076340234);

License

Andrei Zvonimir Crnkovic andrei@infinum.co MIT 2016.