mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-22 15:56:15 -04:00
17 lines
416 B
TypeScript
17 lines
416 B
TypeScript
![]() |
import { useValidation, type ValidationAttrs } from '@/composable/validation';
|
||
|
import type { Ref } from 'vue';
|
||
|
|
||
|
function macAddressValidation(value: Ref) {
|
||
|
return useValidation({
|
||
|
source: value,
|
||
|
rules: [
|
||
|
{
|
||
|
message: 'Invalid MAC address',
|
||
|
validator: (value) => value.trim().match(/^([0-9A-Fa-f]{2}[:-]){2,5}([0-9A-Fa-f]{2})$/),
|
||
|
},
|
||
|
],
|
||
|
});
|
||
|
}
|
||
|
|
||
|
export { macAddressValidation };
|