https://github.com/sh20raj/xvalidatorx
A comprehensive validation library for common data validation tasks.
https://github.com/sh20raj/xvalidatorx
validator validatorjs
Last synced: 6 months ago
JSON representation
A comprehensive validation library for common data validation tasks.
- Host: GitHub
- URL: https://github.com/sh20raj/xvalidatorx
- Owner: SH20RAJ
- License: mit
- Created: 2024-04-09T06:38:57.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-10T01:59:58.000Z (almost 2 years ago)
- Last Synced: 2024-11-16T00:13:39.210Z (about 1 year ago)
- Topics: validator, validatorjs
- Language: JavaScript
- Homepage: https://sh20raj.github.io/XValidatorX/
- Size: 8.79 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# XValidatorX
[](https://www.npmjs.com/package/xvalidatorx)
[](https://github.com/SH20RAJ/XValidatorX/issues)
[](https://github.com/SH20RAJ/XValidatorX/stargazers)
[](https://visitorbadge.io/status?path=https%3A%2F%2Fgithub.com%2FSH20RAJ%2FXValidatorX%2F)
[](https://twitter.com/SH20RAJ)
A comprehensive and light weight validation library for common data validation tasks.
## Installation
You can install `XValidatorX` via npm:
```bash
npm install xvalidatorx
```
Or include it via CDN:
```html
```
## Usage
Here's an example of how you can use `XValidatorX`:
```javascript
import XValidatorX from 'xvalidatorx';
console.log(XValidatorX.isEmail('test@example.com')); // true
console.log(XValidatorX.isURL('https://www.example.com')); // true
// More examples...
```
## Features
- **isEmail(email)**: Checks if a string is a valid email address.
- **isURL(url)**: Checks if a string is a valid URL.
- **isNotEmptyString(str)**: Checks if a string is not empty.
- **isPalindrome(str)**: Checks if a string is a palindrome.
- **isWithinRange(num, min, max)**: Checks if a number is within a specified range.
- **isInArray(value, array)**: Checks if a value exists in an array.
- **isUUID(uuid)**: Checks if a string is a valid UUID.
- **isHexColor(color)**: Checks if a string is a valid HEX color.
- **isDateYYYYMMDD(dateString)**: Checks if a string is a valid date in the format `YYYY-MM-DD`.
- **isCreditCard(cardNumber)**: Checks if a string is a valid credit card number.
- **isPhoneNumber(phone)**: Checks if a string is a valid phone number.
- **isPostalCode(postalCode, countryCode)**: Checks if a string is a valid postal code.
- **isStrongPassword(password)**: Checks if a string is a strong password.
- **isAlpha(str)**: Checks if a string contains only alphabetic characters.
- **isAlphanumeric(str)**: Checks if a string contains only alphanumeric characters.
- **isNumeric(str)**: Checks if a string contains only numeric characters.
### Usage via CDN
You can also use `XValidatorX` directly in the browser via CDN:
```html
```
### Documentation
#### isEmail(email)
Checks if a string is a valid email address.
**Parameters:**
- `email`: String - The email address to validate.
**Example:**
```javascript
const isValidEmail = XValidatorX.isEmail('test@example.com');
console.log(isValidEmail); // true
```
#### isURL(url)
Checks if a string is a valid URL.
**Parameters:**
- `url`: String - The URL to validate.
**Example:**
```javascript
const isValidURL = XValidatorX.isURL('https://www.example.com');
console.log(isValidURL); // true
```
#### isNotEmptyString(str)
Checks if a string is not empty.
**Parameters:**
- `str`: String - The string to check.
**Example:**
```javascript
const isValid = XValidatorX.isNotEmptyString('Hello');
console.log(isValid); // true
```
## Issues
If you encounter any issues or have suggestions, please feel free to [open an issue on GitHub](https://github.com/SH20RAJ/XValidatorX/issues).
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
---
> https://dev.to/sh20raj/xvalidatorx-a-lightweight-validation-library-for-javascript-2c59