password-strength-checker-s 1.0.0

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 (3) hide show
  1. package/index.js +14 -0
  2. package/package.json +14 -0
  3. package/test.js +8 -0
package/index.js ADDED
@@ -0,0 +1,14 @@
1
+ function checkPassword(password) {
2
+ let score = 0;
3
+
4
+ if (password.length >= 8) score++;
5
+ if (/[A-Z]/.test(password)) score++;
6
+ if (/[0-9]/.test(password)) score++;
7
+ if (/[^A-Za-z0-9]/.test(password)) score++;
8
+
9
+ if (score === 4) return "Strong";
10
+ if (score === 3) return "Medium";
11
+ return "Weak";
12
+ }
13
+
14
+ export default checkPassword;
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "password-strength-checker-s",
3
+ "version": "1.0.0",
4
+ "description": "A JavaScript-based password strength checker for basic cybersecurity validation",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "keywords": ["password", "security", "checker"],
8
+ "author": "SPRandhawa",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/SPRandhawa/password-strength-checker.git"
13
+ }
14
+ }
package/test.js ADDED
@@ -0,0 +1,8 @@
1
+ import checkPassword from "./index.js";
2
+
3
+ console.log(checkPassword("abc"));
4
+ console.log(checkPassword("abc123"));
5
+ console.log(checkPassword("Abc@12345"));
6
+ console.log(checkPassword("password"));
7
+ console.log(checkPassword("jaibir27"));
8
+ console.log(checkPassword("J@i$im27R@jN"));