imei validator
Validate an IMEI (International Mobile Station Equipment Identity)
Options
Using with form field
| Name | HTML attribute | Type | Description | 
|---|
message | data-fv-imei___message | String | The error message | 
Using the ES6 module
import { imei } from '/vendors/@form-validation/cjs/validator-imei';
const result = imei().validate({
    value: ...,
    options: {
        message: ...,
    },
});
Using the npm package
- Install the validator package:
 
$ npm install @form-validation/validator-imei
import { imei } from '@form-validation/validator-imei';
const result = imei().validate({
    value: ...,
    options: {
        message: ...,
    },
});
Basic example
NPM package example
The following snippet shows how to use the imei validator with the npm package:
import { imei } from '@form-validation/validator-imei';
const res1 = imei().validate({
    value: '35-209900-176148-1',
    options: {
        message: 'The value is not valid IMEI',
    },
});
const res2 = imei().validate({
    value: '490154203237517',
    options: {
        message: 'The value is not valid IMEI',
    },
});
See also
Changelog