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.
Files changed (2) hide show
  1. package/index.js +5 -1
  2. 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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "show-password-strength",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "A small NPM package for checking password strength.",
5
5
  "main": "index.js",
6
6
  "type": "module",