New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More →

check-password-strength

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

check-password-strength - npm Package Compare versions

Comparing version

to
1.0.7

@@ -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.