GithubHelp home page GithubHelp logo

sh20raj / xvalidatorx Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 9 KB

A comprehensive validation library for common data validation tasks.

Home Page: https://sh20raj.github.io/XValidatorX/

License: MIT License

JavaScript 100.00%
validator validatorjs

xvalidatorx's Introduction

XValidatorX

npm version GitHub issues GitHub stars Visitors Twitter Follow

A comprehensive and light weight validation library for common data validation tasks.

Installation

You can install XValidatorX via npm:

npm install xvalidatorx

Or include it via CDN:

<!-- 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/[email protected]"></script> -->

Usage

Here's an example of how you can use XValidatorX:

import XValidatorX from 'xvalidatorx';

console.log(XValidatorX.isEmail('[email protected]')); // 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:

<!-- 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/[email protected]"></script> -->

Documentation

isEmail(email)

Checks if a string is a valid email address.

Parameters:

  • email: String - The email address to validate.

Example:

const isValidEmail = XValidatorX.isEmail('[email protected]');
console.log(isValidEmail); // true

isURL(url)

Checks if a string is a valid URL.

Parameters:

  • url: String - The URL to validate.

Example:

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:

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.

License

This project is licensed under the MIT License - see the LICENSE file for details.


https://dev.to/sh20raj/xvalidatorx-a-lightweight-validation-library-for-javascript-2c59

xvalidatorx's People

Contributors

sh20raj avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

mr-shade

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.