common-password-rules

Validation methods for some common password policies

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
common-password-rules
000.1.28 years ago8 years agoMinified + gzip package size for common-password-rules in KB

Readme

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])](#module_commonPasswordRules.containsLowerCase) ⇒ <code>Boolean</code>
* [.containsUpperCase(password, [times])](#module_commonPasswordRules.containsUpperCase) ⇒ <code>Boolean</code>
* [.containsDigit(password, [times])](#module_commonPasswordRules.containsDigit) ⇒ <code>Boolean</code>
* [.containsSpecialChar(password, [times])](#module_commonPasswordRules.containsSpecialChar) ⇒ <code>Boolean</code>
* [.contains(password, charSet, [times])](#module_commonPasswordRules.contains) ⇒ <code>Boolean</code>
* [.excludesRecurringChars(password, [times])](#module_commonPasswordRules.excludesRecurringChars) ⇒ <code>Boolean</code>
* [.excludesSequentialLetters(password, [times])](#module_commonPasswordRules.excludesSequentialLetters) ⇒ <code>Boolean</code>
* [.excludesSequentialDigits(password, [times])](#module_commonPasswordRules.excludesSequentialDigits) ⇒ <code>Boolean</code>
* [.excludesBirthDate(password)](#module_commonPasswordRules.excludesBirthDate) ⇒ <code>Boolean</code>

containsLowerCase(password, times) ⇒ Boolean

Checks whether the given password contains a lowercase letter.
| Param | Type | Default | Description | | --- | --- | --- | --- | | password | String | | Password string | | times | Integer | 1 | Minimum number of required lowercase letters |

containsUpperCase(password, times) ⇒ Boolean

Checks whether the given password contains an uppercase letter.
| Param | Type | Default | Description | | --- | --- | --- | --- | | password | String | | Password string | | times | Integer | 1 | Minimum number of required uppercase letters |

containsDigit(password, times) ⇒ Boolean

Checks whether the given password contains a digit.
| Param | Type | Default | Description | | --- | --- | --- | --- | | password | String | | Password string | | times | Integer | 1 | Minimum number of required digits |

containsSpecialChar(password, times) ⇒ Boolean

Checks whether the given password contains a special (non-word) character.
| Param | Type | Default | Description | | --- | --- | --- | --- | | password | String | | Password string | | times | Integer | 1 | Minimum number of required special characters |

contains(password, charSet, times) ⇒ Boolean

Checks whether the given password contains a character from the given set.
| Param | Type | Default | Description | | --- | --- | --- | --- | | password | String | | Password string | | charSet | String | | A regex character set | | times | Integer | 1 | Minimum number of required characters |

excludesRecurringChars(password, times) ⇒ Boolean

Checks that the given password does not contain recurring alphanumeric characters.
| Param | Type | Default | Description | | --- | --- | --- | --- | | password | String | | Password string | | times | Integer | 3 | Minimum recursion number |

excludesSequentialLetters(password, times) ⇒ Boolean

Checks that the given password does not contain sequential case-insensitive letters.
| Param | Type | Default | Description | | --- | --- | --- | --- | | password | String | | Password string | | times | Integer | 3 | Minimum sequence |

excludesSequentialDigits(password, times) ⇒ Boolean

Checks that the given password does not contain sequential digits.
| Param | Type | Default | Description | | --- | --- | --- | --- | | password | String | | Password string | | times | Integer | 3 | Minimum sequence |

excludesBirthDate(password) ⇒ Boolean

Checks that the given password does not a possible birth-date.
| Param | Type | Description | | --- | --- | --- | | password | String | Password string |

License

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