meid validator
Validate a MEID (mobile equipment identifier)
Options
Using with form field
Name | HTML attribute | Type | Description |
---|
message | data-fv-meid___message | String | The error message |
Using the ES6 module
import { meid } from '/vendors/@form-validation/cjs/validator-meid';
const result = meid().validate({
value: ...,
options: {
message: ...,
},
});
Using the npm package
- Install the validator package:
$ npm install @form-validation/validator-meid
import { meid } from '@form-validation/validator-meid';
const result = meid().validate({
value: ...,
options: {
message: ...,
},
});
Basic example
NPM package example
The following snippet shows how to use the meid validator with the npm package:
import { meid } from '@form-validation/validator-meid';
const res1 = meid().validate({
value: 'A00000049259B16',
options: {
message: 'The value is not valid MEID',
},
});
const res2 = meid().validate({
value: '2936087365007037101',
options: {
message: 'The value is not valid MEID',
},
});
See also
Changelog
- Fix an issue that the meid validator passes an invalid MEID which ends with 0