Untitled
const registeredName = (displayName) => { if (!displayName || displayName.length < 8) { return '"displayName" length must be at least 8 characters long'; } return null; }; const registeredEmail = (email) => { if (!email || !/^\S+@\S+\.\S+$/.test(email)) { return '"email" must be a valid email'; } return null; }; const registeredPassword = (password) => { if (!password || password.length < 6) { return '"password" length must be at least 6 characters long'; } return null; }; const registeredInfo = (userInfo) => { const nameError = registeredName(userInfo.displayName); if (nameError) { return nameError; } const emailError = registeredEmail(userInfo.email); if (emailError) { return emailError; } const passwordError = registeredPassword(userInfo.password); if (passwordError) { return passwordError; } return null; }; module.exports = { registeredInfo, };
Leave a Comment