@opuscapita/field-validators
v0.12.0
Published
Common library for master data field validations such as VAT ID, IBAN, etc.
Downloads
171
Maintainers
Keywords
Readme
field-validators
Common library for master data field validations such as VAT ID, IBAN, etc.
The library has the following validators:
- International Bank Account Number (IBAN)
- Bank Identifier Code (BIC)
- Value Added Tax number (VAT)
- Data Universal Numbering System number (DUNS)
- Global Location Number (GLN)
- Finnish Party Identification number (OVT-number) (OVT)
- Company register number (REGNO)
- ISR party number under Swiss IBAN (ISR)
- ABA routing transit number (ABA)
- Tax Identification Number
- LeitwegID Number
To have a look at the full API, please visit the related wiki page.
Setup
Install library by running:
npm install @opuscapita/field-validators
Perform a validation by doing:
const validators = require('@opuscapita/field-validators');
// validate an IBAN
validators.IBAN.isValid('DE10000000000000000000');
// validate a VAT number
validators.VAT.isValid('DE 10000000');
// validate a BIC
validators.BIC.isValid('DEDSLTJXXXX');
// validate a DUNS number
validators.DUNS.isValid('356932675');
// validate a GLN
validators.GLN.isValid('3569326752346');
// validate an OVT
validators.OVT.isValid('003708599126');
// validate a REGNO
validators.REGNO.isValid('Jena GnR 100008', 'DE');
// validate an ISR
validators.ISR.isValid('54-354567-8');
// validate an ABA
validators.ABA.isValid('051000017');
// validate an LeitwegID
validators.LEITWEGID.isValid('04011000-1234512345-06');