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

reg-helper-typescript

v2.0.0

Published

It helps us to validate a parameter, while not writing regular expressions, but just calling some functions

Downloads

35

Readme

RegHelper-typescript

RegHelper is a library for typescript that provides functions to easily validate common inputs like email addresses, passwords, phone numbers, date formats and more. With RegHelper, you don't need to write complex regular expressions, just call the appropriate function to perform the validation.

Installation

You can install RegHelper using NPM:

npm i reg-helper-typescript

Usage

Once installed, you can import RegHelper into your project:

import { RegHelper } from "reg-helper-typescript";

The RegHelper object provides several functions that can be used to validate different types of input. Here are some examples:

Validate Email

const isValidEmail = RegHelper.isEmailRegEx('[email protected]');

that will return true for valid and if not valid, returns false

Validate Password

const isValidPassword = RegHelper.isPasswordRegEx('MyP@ssword123');

This will return true if the password is valid, and false otherwise. By default, RegHelper requires passwords to be at least 8 characters long and contain at least one uppercase letter, one lowercase letter, one number, and one special character.

Validate Phone Number

const isValidPhoneNumber = RegHelper.isPhoneNumberRegEx('+38344007007');

Validate username

const isValidUsername = RegHelper.isUsernameRegEx("user.name",5,20);

First character must be a letter or digit, any subsequent characters can be letters, digits, underscores, periods, or hyphens, The total length of the string must be between minLength and maxLength (inclusive)

Validate code

const isValidCode = RegHelper.isCodeRegEx('PD2Ys8',6);

Lower cases, Upper cases, numbers so in a total length of 6 chars.

Other functions

Url

const isValid = RegHelper.isUrlRegEx('https://github.com/elvirmisini/RegHelper')

For USA SSN

const isValid = RegHelper.isUsSSNRegEx('222-22-2222')

Credit Card

const isValid = RegHelper.isCardRegEx('4111111111111111')

IP address

const isValid = RegHelper.isIPRegEx('192.158.1.38')

USA Zip code

const isValid = RegHelper.isUsZipCodeRegEx('99577-0727')

Date format mm/dd/yyyy

const isValid = RegHelper.isDateMmDdYyyySlashRegEx('12/22/2023')

Date format dd/mm/yyyy

const isValid = RegHelper.isDateDdMmYyyySlashRegEx('22/12/2023')

Date format yyyy/mm/dd

const isValid = RegHelper.isDateYyyyMmDdSlashRegEx('2023/12/22')

Date format mm/dd/yy

const isValid = RegHelper.isDateMmDdYySlashRegEx('12/22/22')

Date format yyyy-mm-dd

const isValid = RegHelper.isDateYyyyMmDdHyphenRegEx('2023-12-12')

Date format mm-dd-yyyy

const isValid = RegHelper.isDateMmDdYyyyHyphenRegEx('12-12-2023')

Date format dd-mm-yyyy

const isValid = RegHelper.isDateDdMmYyyyHyphenRegEx('22-12-2023')

Hexadecimal Color code

const isValid = RegHelper.isHeksadeximalColorCodeRegEx('#123456')

MAC address

const isValid = RegHelper.isMACAdressRegEx('00-B0-D0-63-C2-26')

SubnetMask

const isValid = RegHelper.isSubnetMaskRegEx('255.255.255.0')

Random password generator

const isValid = RegHelper.randomPasswordGeneration()

Password validator, see if your password is strong, weak or moderate

const isValid = RegHelper.validatePassword('PPpassword123.')

Contributing

If you find a bug or want to contribute to the development of RegHelper, please submit a pull request on the GitHub repository.

Version

Version 2.0.0, in the future will come with more features.