domain name validation logic

This commit is contained in:
Aarish
2025-05-24 18:36:56 -05:00
parent f9710d4387
commit 1ef5815f65

13
helpers/utils.js Normal file
View File

@@ -0,0 +1,13 @@
/**
* Utility functions for the application.
*/
const isValidDomain = (domain) => {
// Regular expression to validate a domain name
const domainRegex = /^(?!:\/\/)([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/;
return domainRegex.test(domain);
}
module.exports = {
isValidDomain
};