README
Overview
A simple way to check that password strength of a certain passphrase. A password strength checker based from Javascript RegEx.
Installation
npm i check-password-strength --save
Setup & Basic Usage
const { passwordStrength } = require('check-password-strength')
// OR
import { passwordStrength } from 'check-password-strength'
console.log(passwordStrength('asdfasdf').value)
// Too weak (It will return Too weak if the value doesn't match the RegEx conditions)
console.log(passwordStrength('asdf1234').value)
// Weak
console.log(passwordStrength('Asd1234!').value)
// Medium
console.log(passwordStrength('A@2asdF2020!!*').value)
// Strong
Migration from 1.x.x to 2.0.0
// 1.x.x
const whateEverYourFunctionNameWasBefore = require("./index");
// 'contains' attribute of the response object format was
response.contains = [{'message': 'lowercase'}, ...]
// 2.0.0
const { passwordStrength : whateEverYourFunctionNameWasBefore } = require("./index");
// 'contains' attribute of the response object format is now
response.contains = ['lowercase', ...]
Additional Info
Object Result
| Property| Desc. | | -- | -- | | id | 0 = Too weak, 1 = Weak & 2 = Medium, 3 = Strong | | value | Too weak, Weak, Medium & Strong | | contains | lowercase, uppercase, symbol and/or number | | length | length of the password |
Password Length Default Options
| Name | Mininum Diversity | Mininum Length | | -- | -- | -- | | Too weak | 0 | 0 | | Weak | 2 | 6 | | Medium | 4 | 8 | | Strong | 4 | 10 |
console.log(passwordStrength('@Sdfasd2020!@#