0.1.2 • Published 8 years ago

common-password-rules v0.1.2

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

common-password-rules Build Status Coverage Status

Validation methods for some common password policies.

Install

npm install common-password-rules

Usage

const cPR = require('common-password-rules');

cPR.containsLowerCase('Foo'); // => true

API

containsLowerCase(password, times) ⇒ Boolean

Checks whether the given password contains a lowercase letter.

ParamTypeDefaultDescription
passwordStringPassword string
timesInteger1Minimum number of required lowercase letters

containsUpperCase(password, times) ⇒ Boolean

Checks whether the given password contains an uppercase letter.

ParamTypeDefaultDescription
passwordStringPassword string
timesInteger1Minimum number of required uppercase letters

containsDigit(password, times) ⇒ Boolean

Checks whether the given password contains a digit.

ParamTypeDefaultDescription
passwordStringPassword string
timesInteger1Minimum number of required digits

containsSpecialChar(password, times) ⇒ Boolean

Checks whether the given password contains a special (non-word) character.

ParamTypeDefaultDescription
passwordStringPassword string
timesInteger1Minimum number of required special characters

contains(password, charSet, times) ⇒ Boolean

Checks whether the given password contains a character from the given set.

ParamTypeDefaultDescription
passwordStringPassword string
charSetStringA regex character set
timesInteger1Minimum number of required characters

excludesRecurringChars(password, times) ⇒ Boolean

Checks that the given password does not contain recurring alphanumeric characters.

ParamTypeDefaultDescription
passwordStringPassword string
timesInteger3Minimum recursion number

excludesSequentialLetters(password, times) ⇒ Boolean

Checks that the given password does not contain sequential case-insensitive letters.

ParamTypeDefaultDescription
passwordStringPassword string
timesInteger3Minimum sequence

excludesSequentialDigits(password, times) ⇒ Boolean

Checks that the given password does not contain sequential digits.

ParamTypeDefaultDescription
passwordStringPassword string
timesInteger3Minimum sequence

excludesBirthDate(password) ⇒ Boolean

Checks that the given password does not a possible birth-date.

ParamTypeDescription
passwordStringPassword string

License

MIT http://tameraydin.mit-license.org/