bic validator

Validate a BIC (Business Identifier Codes)

Options

Using with form field
The HTML attributes are used to set the validator options via the Declarative plugin
NameHTML attributeTypeDescription
messagedata-fv-bic___messageStringThe error message
Using the ES6 module
// You might need to change the importing path
import { bic } from '/vendors/@form-validation/cjs/validator-bic';
const result = bic().validate({
value: ...,
options: {
message: ...,
},
});
/*
result is an object of
{
valid: true or false,
message: The error message
}
*/
Using the npm package
  • Install the validator package:
$ npm install @form-validation/validator-bic
  • Use the bic validator:
import { bic } from '@form-validation/validator-bic';
const result = bic().validate({
value: ...,
options: {
message: ...,
},
});

Basic example

bic validator

NPM package example

The following snippet shows how to use the bic validator with the npm package:
import { bic } from '@form-validation/validator-bic';
const res1 = bic().validate({
value: 'DSBACNBXSHA',
options: {
message: 'The value is not valid BIC',
},
});
// res1.valid === true
const res2 = bic().validate({
value: 'RZ00AT2L303',
options: {
message: 'The value is not valid BIC',
},
});
// res2.valid === false

See also

Changelog

v2.0.0
  • Add the npm package