show-password-strength 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +5 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
// Function for checking password is strong
|
|
8
|
-
const showPasswordStrength = (password, minLength) => {
|
|
8
|
+
const showPasswordStrength = (password = "", minLength = 0) => {
|
|
9
|
+
|
|
10
|
+
if(!password || !minLength){
|
|
11
|
+
return {level: "weak", score: 0}
|
|
12
|
+
}
|
|
9
13
|
|
|
10
14
|
const hasLower = /[a-z]/.test(password) // For checking if password contains lower characters
|
|
11
15
|
const hasUpper = /[A-Z]/.test(password) // For checking if password contains upper characters
|