A comprehensive telephone number validator for validating phone numbers across different formats and regions.
-
Multi-format Support: Validates various phone number formats including:
(555) 123-4567555-123-4567555 123 456755512345671 555 123 4567+1 (555) 123-4567
-
Flexible Validation: Supports US phone number validation with optional country code
-
Clean Interface: Simple and intuitive user interface
-
Real-time Validation: Instant feedback on phone number validity
-
Cross-platform: Works on web browsers and mobile devices
- Modern web browser with JavaScript support
- No additional dependencies required
- Clone the repository:
git clone https://github.com/HugoAdona/dialverify.git- Navigate to the project directory:
cd dialverify- Open
index.htmlin your web browser or serve it using a local server:
# Using Python
python -m http.server 8000
# Using Node.js (with http-server)
npx http-server- Open the application in your web browser
- Enter a phone number in the input field
- Click the "Validate" button or press Enter
- The validator will display whether the number is valid or invalid
The validator accepts the following US phone number formats:
555-555-5555(555)555-5555(555) 555-5555555 555 555555555555551 555 555 55551 (555) 555-55551(555)555-5555
555-5555(too short)5555555(too short)1 555)555-5555(invalid format)123**&!!asdf#(invalid characters)55555555555555555555(too long)
Validates a given phone number string.
Parameters:
number(string): The phone number to validate
Returns:
boolean:trueif valid,falseif invalid
Example:
const result = validatePhoneNumber("(555) 123-4567");
console.log(result); // trueThe project includes comprehensive test cases covering:
- Valid US phone number formats
- Invalid phone number formats
- Edge cases and special characters
- Country code validation
To run tests (if applicable):
# Add your testing framework command here
npm testContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Hugo Adona
- GitHub: @HugoAdona
- Inspired by the FreeCodeCamp JavaScript Algorithms and Data Structures certification
- Built as part of the Telephone Number Validator project
- Thanks to the open-source community for inspiration and resources
If you have any questions or run into issues, please open an issue on GitHub or contact the maintainer.
Made with ❤️ by Hugo Adona