From 7cf6e16021fd0d6f941b807ab47e7486f8edda4f Mon Sep 17 00:00:00 2001 From: Brent Salisbury Date: Tue, 24 Dec 2024 10:52:38 -0500 Subject: [PATCH] Remove old validation util - These functions were moved to Knowledge/validation.tsx and Skills/validation.tsx Signed-off-by: Brent Salisbury --- src/utils/validation.ts | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 src/utils/validation.ts diff --git a/src/utils/validation.ts b/src/utils/validation.ts deleted file mode 100644 index 4fe3242f..00000000 --- a/src/utils/validation.ts +++ /dev/null @@ -1,37 +0,0 @@ -// src/utils/validation.ts -export const validateFields = (fields: Record): { valid: boolean; title: string; message: string } => { - for (const [key, value] of Object.entries(fields)) { - if (value.trim() === '') { - return { - valid: false, - title: `Please make sure you complete the ${key} field`, - message: `Some fields are not filled out` - }; - } - } - return { valid: true, title: '', message: '' }; -}; - -export const validateEmail = (email: string): { valid: boolean; title: string; message: string } => { - const emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/; - if (!emailRegex.test(email)) { - return { - valid: false, - title: `Email address issue!`, - message: `Please enter a valid email address.` - }; - } - return { valid: true, title: '', message: '' }; -}; - -export const validateUniqueItems = (items: string[], itemType: string): { valid: boolean; title: string; message: string } => { - const uniqueItems = new Set(items); - if (uniqueItems.size !== items.length) { - return { - valid: false, - title: `Seed example issue!`, - message: `Please make sure all the ${itemType} are unique!` - }; - } - return { valid: true, title: '', message: '' }; -};