All Projects → tarunbatra → Password Validator

tarunbatra / Password Validator

Licence: mit
Validates password according to flexible and intuitive specification

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Password Validator

Vee Validate
✅ Form Validation for Vue.js
Stars: ✭ 8,820 (+3837.5%)
Mutual labels:  validation, validation-library, validate
fefe
Validate, sanitize and transform values with proper TypeScript types and zero dependencies.
Stars: ✭ 34 (-84.82%)
Mutual labels:  schema, validation, validate
reach-schema
Functional schema-driven JavaScript object validation library.
Stars: ✭ 34 (-84.82%)
Mutual labels:  schema, validate, validation-library
Php Validate
Lightweight and feature-rich PHP validation and filtering library. Support scene grouping, pre-filtering, array checking, custom validators, custom messages. 轻量且功能丰富的PHP验证、过滤库。支持场景分组,前置过滤,数组检查,自定义验证器,自定义消息。
Stars: ✭ 225 (+0.45%)
Mutual labels:  validation, validation-library, validate
Typescript Runtime Type Benchmarks
Benchmark Comparison of Packages with Runtime Validation and TypeScript Support
Stars: ✭ 119 (-46.87%)
Mutual labels:  validation, validation-library
Rdfunit
An RDF Unit Testing Suite
Stars: ✭ 117 (-47.77%)
Mutual labels:  schema, validation
Awesome Python Models
A curated list of awesome Python libraries, which implement models, schemas, serializers/deserializers, ODM's/ORM's, Active Records or similar patterns.
Stars: ✭ 124 (-44.64%)
Mutual labels:  schema, validation
Framework
Strongly-typed JavaScript object with support for validation and error handling.
Stars: ✭ 136 (-39.29%)
Mutual labels:  schema, validation
Validator Collection
Python library of 60+ commonly-used validator functions
Stars: ✭ 91 (-59.37%)
Mutual labels:  validation, validation-library
Form Validation.js
The most customizable validation framework for JavaScript.
Stars: ✭ 127 (-43.3%)
Mutual labels:  validation, validate
Node Convict
Featureful configuration management library for Node.js
Stars: ✭ 1,855 (+728.13%)
Mutual labels:  schema, validation
Bootstrap Validate
A simple Form Validation Library for Bootstrap 3 and Bootstrap 4 not depending on jQuery.
Stars: ✭ 112 (-50%)
Mutual labels:  validation, validate
Validator
Drop in user input validation for your iOS apps.
Stars: ✭ 1,444 (+544.64%)
Mutual labels:  validation, validation-library
Schematics
Project documentation: https://schematics.readthedocs.io/en/latest/
Stars: ✭ 2,461 (+998.66%)
Mutual labels:  schema, validation
Postguard
🐛 Statically validate Postgres SQL queries in JS / TS code and derive schemas.
Stars: ✭ 104 (-53.57%)
Mutual labels:  schema, validation
Pandasschema
A validation library for Pandas data frames using user-friendly schemas
Stars: ✭ 135 (-39.73%)
Mutual labels:  schema, validation
Joiful
TypeScript Declarative Validation for Joi
Stars: ✭ 177 (-20.98%)
Mutual labels:  schema, validation
Schema Utils
Options Validation
Stars: ✭ 162 (-27.68%)
Mutual labels:  schema, validation
Deep Waters
🔥Deep Waters is an easy-to-compose functional validation system for javascript developers 🔥
Stars: ✭ 188 (-16.07%)
Mutual labels:  validation, validation-library
Vue Rawmodel
RawModel.js plugin for Vue.js v2. Form validation has never been easier!
Stars: ✭ 79 (-64.73%)
Mutual labels:  schema, validation

logo

npm version npm downloads build status coverage status

Install

npm install password-validator

Usage

var passwordValidator = require('password-validator');

// Create a schema
var schema = new passwordValidator();

// Add properties to it
schema
.is().min(8)                                    // Minimum length 8
.is().max(100)                                  // Maximum length 100
.has().uppercase()                              // Must have uppercase letters
.has().lowercase()                              // Must have lowercase letters
.has().digits(2)                                // Must have at least 2 digits
.has().not().spaces()                           // Should not have spaces
.is().not().oneOf(['Passw0rd', 'Password123']); // Blacklist these values

// Validate against a password string
console.log(schema.validate('validPASS123'));
// => true
console.log(schema.validate('invalidPASS'));
// => false

// Get a full list of rules which failed
console.log(schema.validate('joke', { list: true }));
// => [ 'min', 'uppercase', 'digits' ]

Rules

Rules supported as of now are:

Rules Descriptions
digits([count]) specifies password must include digits (optionally provide count paramenter to specify at least n digits)
letters([count]) specifies password must include letters (optionally provide count paramenter to specify at least n letters)
lowercase([count]) specifies password must include lowercase letters (optionally provide count paramenter to specify at least n lowercase letters)
uppercase([count]) specifies password must include uppercase letters (optionally provide count paramenter to specify at least n uppercase letters)
symbols([count]) specifies password must include symbols (optionally provide count paramenter to specify at least n symbols)
spaces([count]) specifies password must include spaces (optionally provide count paramenter to specify at least n spaces)
min(len) specifies minimum length
max(len) specifies maximum length
oneOf(list) specifies the whitelisted values
not([regex]) inverts the result of validations applied next
is() inverts the effect of not()
has([regex]) inverts the effect of not() and applies a regex (optional)

Options

The following options can be passed to validate method:

  • list - If set, validate method returns a list of rules which failed instead of true/false.

Resources

For APIs of other older versions, head to Wiki.

License

MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].