imo validator
Validate an IMO (International Maritime Organization)
Options
Using with form field
Name | HTML attribute | Type | Description |
---|
message | data-fv-imo___message | String | The error message |
Using the ES6 module
import { imo } from '/vendors/@form-validation/cjs/validator-imo';
const result = imo().validate({
value: ...,
options: {
message: ...,
},
});
Using the npm package
- Install the validator package:
$ npm install @form-validation/validator-imo
import { imo } from '@form-validation/validator-imo';
const result = creditCard().validate({
value: ...,
options: {
message: ...,
},
});
Basic example
NPM package example
The following snippet shows how to use the imo validator with the npm package:
import { imo } from '@form-validation/validator-imo';
const res1 = imo().validate({
value: 'IMO 9074729',
options: {
message: 'The value is not valid IMO',
},
});
const res2 = imo().validate({
value: '9074729',
options: {
message: 'The value is not valid IMO',
},
});
Changelog