sivar-utils 🇸🇻
TS/JS utils para el desarrollo de sistemas salvadoreños (Validacion de docs DUI, NIT, etc...)
Getting Started
Installation
npm install --save sivar-utils
Usage
import { isDUI } from 'sivar-utils';
const str = 'test';
const fakeDUI = '00000000-0';
const validDUI = '02495046-3';
isDUI(str);
isDUI(fakeDUI);
isDUI(validDUI);
import { isNIT } from 'sivar-utils';
const str = 'test';
const fakeNIT = '0000-000000-000-0';
const validNIT = '0614-051286-129-4';
const alsoValidNIT = '06140512861294';
isNIT(str);
isNIT(fakeNIT);
isNIT(validNIT);
isNIT(alsoValidNIT);
import { isMobilePhoneNumber } from 'sivar-utils';
const str = 'test';
const fakeMobilePhone = '9999-9999';
const validMobilePhone = '7071-1244';
isMobilePhoneNumber(str);
isMobilePhoneNumber(fakeMobilePhone);
isMobilePhoneNumber(validMobilePhone);
import { isResidentialPhoneNumber } from 'sivar-utils';
const str = 'test';
const fakeResidentialPhone = '5555-5555';
const validResidentialPhone = '2244-4777';
isResidentialPhoneNumber(str);
isResidentialPhoneNumber(fakeResidentialPhone);
isResidentialPhoneNumber(validResidentialPhone);
import { isPhoneNumber } from 'sivar-utils';
const str = 'test';
const fakePhone = '1234-5678';
const validPhone = '2591-3000';
isPhoneNumber(str);
isPhoneNumber(fakePhone);
isPhoneNumber(validPhone);
import { isPassport } from 'sivar-utils';
const str = 'test';
const fakePassport = '$03766021';
const validPassport = 'A12345678';
isPassport(str);
isPassport(fakePassport);
isPassport(validPassport);
import { isCarPlate } from 'sivar-utils';
const str = 'test';
const fakePlate = 'XY525929';
const validNationalPlate = 'N10731';
const validParticularPlate = 'p525929';
isCarPlate(str);
isCarPlate(fakePlate);
isCarPlate(validNationalPlate);
isCarPlate(validParticularPlate);
Contributing
How to contribute?
This is a commitizen friendly
repository, so instead of creating commits using git commit
, please use our custom CLI by running:
npm run cz
Formatting & Linting
Make sure you have installed the following plugins on your Code Editor
Contributors ✨
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
License
MIT © jonathanpalma