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 🙏

© 2025 – Pkg Stats / Ryan Hefner

validate-password

v1.0.4

Published

Strengthen your user's passwords

Readme

Validate Password

JS password validation for the client and the server.

npm version license

Enforce stronger passwords for users by checking for uppercase/lowercase letters, numbers, and special characters.

You can also check passwords for certain strings. This is ideal for preventing users from entering their name or email in the password. Or, you can search the password for common words, to further encourage the user to pick a strong password.

Features

  • [x] Lowercase verification
  • [x] Uppercase verification
  • [x] Special Characters verification
  • [x] Numbers verification
  • [x] Strings that are not allowed verification

Installation

Install via NPM:

npm install validate-password

##Usage

This can be used as a stand alone package:

<script src="node_modules/validate-password/dist/validate-password.min.js"></script>

or as a CommonJS module:

var ValidatePassword = require('validate-password');

Start by instantiating the password validator:

var validator = new ValidatePassword();

...And use the .checkPassword() method to validate the password.

.checkPassword() accepts two arguments - first, the password as a string:

var passwordData = validator.checkPassword('aaaaa');

console.log(passwordData.isValid); // false
console.log(passwordData.validationMessage); // 'The password must contain at least one uppercase letter'

And, optionally, an array of strings that are not allowed to be in the password:

var checkPasswordForName = validator.checkPassword('cat123aaBa$%^#$%#$%', ['cat123']);

console.log(passwordData.isValid); // false
console.log(passwordData.validationMessage); // 'The password cannot contain cat123'

See the examples directory for more detailed use cases...

##Options

By default, the validator checks for uppercase/lowercase letters, numbers, and special characters.
You can also pass in custom configuration options when instantiating the validator, to loosen these default rules:

var options = {
        enforce: {
            lowercase: true,
            uppercase: true,
            specialCharacters: false,
            numbers: true
        }
    };

var validator = new ValidatePassword(options);

The validator will now not check the password for special characters...

Contribute

We would love for you to contribute to validate-password, check the LICENSE file for more info.

Meta

Mike DeWitt – http://devdewitt.com/

Distributed under the MIT license. See LICENSE for more information.

https://github.com/mndewitt/validate-password