This pull request refactors the validateInput.js utility functions to streamline the validation process for usernames, emails, and passwords. By consolidating these functions into a single validateInput function that uses a switch case, we enhance code readability and maintainability. This change also lays the groundwork for easily adding more types of input validation in the future, such as phone numbers.
Summary
Refactored validateUsername, validateEmail, and validatePassword into a single validateInput function.
Implemented a switch case in validateInput to handle different types of input validation:
username: Validates that the username is 3-20 characters long and can contain letters, numbers, and underscores.
email: Validates that the email is in a proper format.
password: Validates that the password is at least 8 characters long, contains at least one letter and one number.
Prepared the structure for future validation types (e.g., phone number validation) with a placeholder case.
Updated the module exports to reflect the changes in the utility functions.
Enhanced error handling by throwing an error for invalid validation types.
Fixes #134.
π Latest improvements to Sweep:
New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
PR Feedback (click)
Description
This pull request refactors the
validateInput.js
utility functions to streamline the validation process for usernames, emails, and passwords. By consolidating these functions into a singlevalidateInput
function that uses a switch case, we enhance code readability and maintainability. This change also lays the groundwork for easily adding more types of input validation in the future, such as phone numbers.Summary
validateUsername
,validateEmail
, andvalidatePassword
into a singlevalidateInput
function.validateInput
to handle different types of input validation:username
: Validates that the username is 3-20 characters long and can contain letters, numbers, and underscores.email
: Validates that the email is in a proper format.password
: Validates that the password is at least 8 characters long, contains at least one letter and one number.Fixes #134.
π Latest improvements to Sweep:
π‘ To get Sweep to edit this pull request, you can:
This is an automated message generated by Sweep AI.