mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-05 05:47:10 -04:00
feat(new tool): random MAC address generator (#657)
* #521 Random MAC address generator * refactor(mac-address-generator): improved ux * refactor(mac-address-generator): improved ux --------- Co-authored-by: Corentin THOMASSET <corentin.thomasset74@gmail.com>
This commit is contained in:
parent
681f7bf644
commit
cc3425dc77
8 changed files with 205 additions and 2 deletions
|
@ -15,4 +15,18 @@ function macAddressValidation(value: Ref) {
|
|||
});
|
||||
}
|
||||
|
||||
export { macAddressValidation, macAddressValidationRules };
|
||||
const partialMacAddressValidationRules = [
|
||||
{
|
||||
message: 'Invalid partial MAC address',
|
||||
validator: (value: string) => value.trim().match(/^([0-9a-f]{2}[:\-. ]){0,5}([0-9a-f]{0,2})$/i),
|
||||
},
|
||||
];
|
||||
|
||||
function usePartialMacAddressValidation(value: Ref) {
|
||||
return useValidation({
|
||||
source: value,
|
||||
rules: partialMacAddressValidationRules,
|
||||
});
|
||||
}
|
||||
|
||||
export { macAddressValidation, macAddressValidationRules, usePartialMacAddressValidation, partialMacAddressValidationRules };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue