diff --git a/helpers/utils.js b/helpers/utils.js new file mode 100644 index 0000000..e9e7c46 --- /dev/null +++ b/helpers/utils.js @@ -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 +};