aboutsummaryrefslogtreecommitdiff
path: root/src/utils/macAddress.ts
diff options
context:
space:
mode:
authorGravatar Corentin Thomasset <corentin.thomasset74@gmail.com> 2023-05-15 00:41:45 +0200
committerGravatar Corentin THOMASSET <corentin.thomasset74@gmail.com> 2023-05-15 01:31:22 +0200
commitf7fc779e6334af129e323ae6ec22d97059eb0363 (patch)
tree4435f7128b6aa7fcbf54f60bcce75c8f2eafe33e /src/utils/macAddress.ts
parentb3b6b7c46bfe8b6c11e3ca97a4e2741c7225b534 (diff)
downloadit-tools-f7fc779e6334af129e323ae6ec22d97059eb0363.tar.gz
it-tools-f7fc779e6334af129e323ae6ec22d97059eb0363.tar.zst
it-tools-f7fc779e6334af129e323ae6ec22d97059eb0363.zip
refactor(ui): replaced some n-input with c-input-text
Diffstat (limited to 'src/utils/macAddress.ts')
-rw-r--r--src/utils/macAddress.ts16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/utils/macAddress.ts b/src/utils/macAddress.ts
index ff6000c..89f12d3 100644
--- a/src/utils/macAddress.ts
+++ b/src/utils/macAddress.ts
@@ -1,16 +1,18 @@
import { useValidation } from '@/composable/validation';
import type { Ref } from 'vue';
+const macAddressValidationRules = [
+ {
+ message: 'Invalid MAC address',
+ validator: (value: string) => value.trim().match(/^([0-9A-Fa-f]{2}[:-]){2,5}([0-9A-Fa-f]{2})$/),
+ },
+];
+
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})$/),
- },
- ],
+ rules: macAddressValidationRules,
});
}
-export { macAddressValidation };
+export { macAddressValidation, macAddressValidationRules };