check-password-strength
Advanced tools
Comparing version
31
index.js
@@ -1,7 +0,9 @@ | ||
export function passwordStrength(password) { | ||
let strength = { // Default | ||
id: 0, | ||
value: 'Weak' | ||
module.exports = (password) => { | ||
if (!password) { | ||
console.error("check-password-strength package - requires a password value.") | ||
return undefined | ||
} | ||
let strength = {} // Default | ||
const strongRegex = new RegExp( | ||
@@ -15,12 +17,19 @@ "^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})" | ||
if (strongRegex.test(password)) { | ||
strength.id = 2 | ||
return strength; | ||
strength = { | ||
id: 2, | ||
value: 'Strong' | ||
} | ||
} else if (mediumRegex.test(password)) { | ||
strength.id = 1 | ||
strength.value = 'Medium' | ||
strength = { | ||
id: 1, | ||
value: 'Medium' | ||
} | ||
} else { | ||
strength.id = 0 | ||
strength.value = 'Weak' | ||
strength = { | ||
id: 0, | ||
value: 'Weak' | ||
} | ||
} | ||
return strength; | ||
return strength | ||
} |
{ | ||
"name": "check-password-strength", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "A NPM Password strength checker based from Javascript RegExp. Check passphrase if it's \"Weak\", \"Medium\" or \"Strong\"", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "mocha" | ||
}, | ||
@@ -30,3 +30,7 @@ "repository": { | ||
}, | ||
"homepage": "https://github.com/deanilvincent/check-password-strength#readme" | ||
"homepage": "https://github.com/deanilvincent/check-password-strength#readme", | ||
"dependencies": { | ||
"chai": "^4.2.0", | ||
"mocha": "^7.1.0" | ||
} | ||
} |
@@ -12,3 +12,3 @@ | ||
``` | ||
const { passwordStrength } = require('check-password-strength') | ||
const passwordStrength = require('check-password-strength') | ||
@@ -63,5 +63,3 @@ console.log(passwordStrength('asdfasdf').value) | ||
I'll be glad if you give this project a ★ on [Github](https://github.com/deanilvincent/check-password-strength) :)) | ||
### License | ||
This project is licensed under the MIT License - see the [LICENSE.md](https://github.com/deanilvincent/check-password-strength/blob/master/LICENSE.md/) file for details. |
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
6385
31.22%6
50%62
181.82%0
-100%2
Infinity%63
-3.08%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added