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

valiend

v1.2.0

Published

a package for validate and check auth input

Downloads

87

Readme

valiend

valiend.com

Valiend

Valiend is an open source package created to make checking email, password and phone number input easier. By using this package, you can check these inputs much more easily than before and develop different conditions in your project according to them.

install

This is a Node.js module available through the npm registry. Installation is done using the npm install command:

$ npm install valiend

Usage

To use valiend, you must call it according to your use of common js or es module

Common JS

const valiend = require('valiend'); //common js

valiend.isEmail('[email protected]');

ES Module

import {isEmail} from 'valiend'; //ES Module

isEmail('[email protected]');

Features

check validate email

valiend.isEmail('[email protected]'); //true

check validate Phone number

valiend.isPhoneNumber('+989121234567'); //true

valiend.isPhoneNumber('09121234567',['fa-IR']); //true

check validate Postal Code

valiend.isPostalCode('12345-12345'); //true

valiend.isPostalCode('12345-12345',['fa-IR','de-DE']); //true

check validate VAT number

valiend.isVAT('DE494050532',['de-DE']); //true

Check the contents of the password

valiend.passwordContains('Test4:@5tARian');
/*{
  isHaveCapitalLetter: true,
  isHaveSmallLetter: true,
  isHaveNumber: true,
  isHaveCharacter: true,
  passwordLength: 14,
  capitalLetterCount: 3,
  smallLetterCount: 7,
  numberCount: 2,
  characterCount: 2
}*/

Separate different parts of the email

valiend.separateEmail("[email protected]");
/*{
  emailUsername: 'aeromche',
  emailSymbol: '@',
  emailMailServer: 'gmail',
  emailMailServerUrl: 'gmail.com',
  emailDomain: '.com'
}*/

Create a random password

valiend.passwordGenerator(12); //r_YXST46!a7e

Check password quality

valiend.passwordQuality('Honh3443') //75

Check for numeric value

valiend.isNumeric("1237653423") //true
valiend.isNumeric("12376e423") //false

Checking whether the input value is within the range

valiend.isInRange(32,{minRange : 18,maxRange : 90}) //true

Checking the validity of a user name in terms of the characters used

valiend.isUsername("ariankoochak") //true
valiend.isUsername("_.aeromche._",{validChars : ['@','_','$','#','.']}) //true
valiend.isUsername("@eromche") //false
valiend.isUsername("@eromche$_") //false

Checking the security and strength of the password

valiend.isSafePassword("A5h#3232") //true
valiend.isSafePassword("aadfdf") //false
valiend.isSafePassword("SA23sa#$",{strictMode : true}) //true
valiend.isSafePassword("A5h#3232",{strictMode : true}) //false

Creating a random otp (one time password) numerically

valiend.getOtpCode() //85943
valiend.getOtpCode({otpLength : 7}) //0856473

Validate all data together

  inputs = {
      username: "@riankoc",
      password: "aeromch@e3",
      email: "[email protected]",
  };
  const schema = valiend.schemaMaker({
      usernameSchema: {
          validChars: ["_"],
      },
      passwordSchema: {
          safePassword: true,
      },
  });
  valiend.valiendCheck(inputs, schema)
  /*
    {
        result: false,
        errors: [{username : "username not valid"},{ password: "password is not safe" }],
    }
  */
  inputs = {
      username: "@riankoc",
      password: "aeromch@e3",
      email: "[email protected]",
  };
  const schema = valiend.schemaMaker({
      usernameSchema: {
          validChars: ["_"],
      },
      passwordSchema: {
          safePassword: true,
      },
  });
  valiend.valiendCheck(inputs, schema)
  /*
    {
        result: false,
        errors: [{username : "username not valid"},{ password: "password is not safe" }],
    }
  */