npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

validate-utility

v0.0.2

Published

This package is used to validate user input and check many types of regexs.

Downloads

296

Readme

validate-utility

This package is used to validate user input and check many types of regexs.

Installation

Run : npm i validate-utility

Usage

| Function name | Description | | ------------- | ------------------------------ | | validate(selector , id , callBack) | This method is used with input attribute as used in sample code | | url(value) | Validate URL. | | email(value) | Validate email. | | alnum(value) | Validate string with alpha and numeric only. | | alnumwithspace(value) | Validate alpha and numeric string with space . | | alpha(value) | Validate string contains alphabets . | | number(value) | Validate string if it only contains number. | | postcode(value) | Validate postcode or zipcode. | | mobile(value) | Validate mobile number. | | pancard(value) | Validate pancard number. | | DateBelow2000(value) | Validate date before 2000. | | DateBelow2000R(value) | Validate date after 2000. | | fullnamewithspace(value) | Validate full name with space. | | voterID(value) | Validate voter id. | | dl(value) | Validate driving licence. | | passport(value) | Validate passport. | | timeString(value) | Validate if string is timestring. | | dateString(value) | Validate datestring. | | hexadecimal(value) | Validate string is hesadecimal or not. | | hexColor(value) | Validate staring has hexcolor. | | ipv4(value) | Validate IP in v4 format. | | ipv6(value) | Validate IP in v6 format. | | ipV4V6(value) | Validate IP in v4 and v6 both. | | ip(value) | Validate only IP. | | vehiclenumber(value) | Validate vehicle number. | | pan(value) | Validate pan. | | minLength(value , minLength) | This method is used to validate minLength. | | maxLength(value , maxLength) | This method is used to validate maxLength. | | required(value) | This method checks if field is required. | | isEmpty(value) | This method checks if string is empty. | | minValue(value , minValue) | This method checks minimum value for numbers. | | equalTo(value1 , value2) | This method checks equality. | | equalTo(value1 , value2) | This method checks equality. | | isChecked(selector) | This methods checks if checkbox is checked. |

Note : It return true if validation is successfull

Sample Code

    function cb (error , id , selector) {
       console.log(error);
       it prints {
              status: true,
              message: ""}
       }
       
    <input type="text"   
       data-vu-err-msg="this is error message"
       onKeyUp={(e) => validateUtility.validate(e.target , "tets" , cb }) } 
       onKeyPress={(e) => validateUtility.stopDefault(e)} // to stop keyboard event
       data-vu-type="required,minLength,alpha" // type of validation required (any methid name can be used here like mobile,url,email etc
       data-vu-min-length="6"
       data-vu-err-msg="This is error message" // this is to print error message (it's optional')
       //data-vu-min-value="8"
    />