XValidatorX: A Lightweight Validation Library for JavaScript
Tags: javascript, validation
Published: 2024-04-10 01:56:08

# Introducing XValidatorX: A Lightweight Validation Library for JavaScript


{% github https://github.com/SH20RAJ/XValidatorX %}



Welcome developers! Today, we're excited to introduce **XValidatorX**, a versatile and lightweight JavaScript library for data validation tasks. Whether you're validating email addresses, checking URLs, or ensuring strong passwords, XValidatorX has got you covered!

## Installation

You can install XValidatorX via npm:

```bash
npm install xvalidatorx
```

Or include it directly in your project using CDN:

```html
<!-- Latest release -->
<script src="https://cdn.jsdelivr.net/gh/SH20RAJ/XValidatorX@latest/xvalidatorx.js"></script>

<!-- <script src="https://cdn.jsdelivr.net/npm/xvalidatorx"></script> -->

<!-- Specific version (replace '1.0.0' with the desired version) -->
<!-- <script src="https://cdn.jsdelivr.net/npm/xvalidatorx@1.0.0"></script> -->
```

## Usage

Using XValidatorX is as simple as it gets! Here's a quick example:

```javascript
import XValidatorX from 'xvalidatorx';

console.log(XValidatorX.isEmail('test@example.com')); // true
console.log(XValidatorX.isURL('https://www.example.com')); // true
// Explore more examples below!
```

## Features Galore!

XValidatorX offers a wide range of validation methods:

- **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
<!-- Latest release -->
<script src="https://cdn.jsdelivr.net/npm/xvalidatorx"></script>

<!-- Specific version (replace '1.0.0' with the desired version) -->
<!-- <script src="https://cdn.jsdelivr.net/npm/xvalidatorx@1.0.0"></script> -->
```

## Documentation

Let's dive into some examples:

### 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
```

<!-- ### More Methods...

You can find detailed examples and parameters for all methods in the XValidatorX Documentation. -->

## Get Started Now!

Start using XValidatorX today by installing it via npm or including it in your project using CDN. Don't hesitate to explore its features and let us know your thoughts!

## Issues & Contributions

If you encounter any issues or have suggestions for improvements, please feel free to [open an issue on GitHub](https://github.com/SH20RAJ/XValidator

X/issues). Contributions are also welcome!

## Connect with Us!

Follow us on [Twitter](https://twitter.com/SH20RAJ) for updates and announcements. Your feedback is invaluable to us!

## License

This project is licensed under the MIT License - see the [LICENSE](https://github.com/SH20RAJ/XValidator/LICENSE) file for details.


---


[![npm version](https://img.shields.io/npm/v/xvalidatorx.svg)](https://www.npmjs.com/package/xvalidatorx)
[![GitHub issues](https://img.shields.io/github/issues/SH20RAJ/XValidatorX)](https://github.com/SH20RAJ/XValidatorX/issues)
[![GitHub stars](https://img.shields.io/github/stars/SH20RAJ/XValidatorX)](https://github.com/SH20RAJ/XValidatorX/stargazers)
![Visitors](https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2FSH20RAJ%2FXValidatorX%2F&labelColor=%23f47373&countColor=%232ccce4&style=flat)
[![Twitter Follow](https://img.shields.io/twitter/follow/SH20RAJ.svg?style=social)](https://twitter.com/SH20RAJ)