A lightweight password strength checker for Node.js projects.
npm install av-password-strength-checkerA lightweight password strength checker for Node.js projects.
This package enables the evaluation of password strength based on multiple criteria. It provides precise feedback for users to create strong passwords. The tool can be used as a Node.js module.
---
- Evaluates password length, lowercase, uppercase, numeric, and special character criteria
- Provides feedback on missing requirements for strengthening passwords
- Easy integration as a Node.js module
- No external runtime dependencies apart from dev/testing
- Includes automated tests with Jest
---
- Language: JavaScript (Node.js)
- CLI: Built-in readline and process modules
- Testing: Jest
---
Install with npm:
``bash`
npm install av-password-strength-checker
---
javascript
const { checkPassword } = require('av-password-strength-checker');const result = checkPassword('MyPassword123');
console.log(
Strength: ${result.strength});
console.log('Feedback:');
result.feedback.forEach(msg => console.log(- ${msg}));
`Sample Output:
`
Password: "YourPassword123"
Strength: GOOD (4/5)
✓ Good length
✓ Has lowercase
✓ Has uppercase
✓ Has numbers
✗ Add special characters
`---
5. Password Strength Logic
Criteria:
- Length: Minimum 8 characters
- Lowercase: At least one lowercase letter
[a-z]
- Uppercase: At least one uppercase letter [A-Z]
- Numbers: At least one numeric digit [0-9]
- Special Characters: At least one symbol (e.g., !@#$%^&*()) Strength Mapping:
| Score | Strength |
|-------|-----------|
| 0–2 | WEAK |
| 3 | OKAY |
| 4 | GOOD |
| 5 | STRONG |
Feedback messages indicate criteria met and what is missing.
---
6. File Structure
`
src/index.js # Core logic for password strength evaluation
src/cli.js # Command-line interface (CLI)
test/index.test.js # Jest-based automated tests for code reliability
test_package\test-package.js # program with predefined test cases
package.json # Project metadata, configuration, dependencies
README.md # Project documentation
``---
- Evaluates password complexity and diversity.
- Does not check against breached password databases.
- Should be used alongside additional security measures such as hashing, rate limiting, and breach checks.
---