Skip to main content
Version: Next

passwordContains

By using this method, you can find out what type of characters the received password (or any other string value you received) contains and how many of each type of character it has.

Params

passwordContains(str);
  • str → str The string you want checked

Returns

{
isHaveCapitalLetter: true,
isHaveSmallLetter: true,
isHaveNumber: true,
isHaveCharacter: true,
passwordLength: 14,
capitalLetterCount: 3,
smallLetterCount: 7,
numberCount: 2,
characterCount: 2
}
  • Object → An object that contains information about the contents of str

Usage

passwordContains("dsfdsg434");
/* {
isHaveCapitalLetter: false,
isHaveSmallLetter: true,
isHaveNumber: true,
isHaveCharacter: false,
passwordLength: 9,
capitalLetterCount: 0,
smallLetterCount: 6,
numberCount: 3,
characterCount: 0,
} */

passwordContains("aa@$SD34");
/* {
isHaveCapitalLetter: true,
isHaveSmallLetter: true,
isHaveNumber: true,
isHaveCharacter: true,
passwordLength: 8,
capitalLetterCount: 2,
smallLetterCount: 2,
numberCount: 2,
characterCount: 2,
} */