7
7
</p >
8
8
9
9
## Demo
10
- Try it yourself in this ** [ CodeSandbox demo] ( https://codesandbox.io/p/github/tiavina-mika/check-password-complexity-demo ) **
11
- Or
12
- this ** [ Live demo] ( https://check-password-complexity.netlify.app/ ) **
10
+ - ** [ CodeSandbox demo] ( https://codesandbox.io/p/github/tiavina-mika/check-password-complexity-demo ) **
11
+ - ** [ Live demo] ( https://check-password-complexity.netlify.app/ ) **
13
12
14
13
15
14
## Installation
16
15
17
16
``` shell
18
-
19
- npm install check-password-complexity
20
-
17
+ npm install check-password-complexity
21
18
```
22
19
or
23
20
``` shell
24
-
25
- yarn add check-password-complexity
21
+ yarn add check-password-complexity
26
22
```
27
23
28
-
29
24
## Get started
30
25
31
26
#### Simple usage
@@ -39,17 +34,17 @@ const { checkPasswordComplexity } require("check-password-complexity");
39
34
40
35
console .log (checkPasswordComplexity (" abcdefgh" ).value ); // tooWeak
41
36
42
- console . log ( checkPasswordComplexity (" abcdefg8" ).value ) ; // weak
37
+ checkPasswordComplexity (" abcdefg8" ).value ; // weak
43
38
44
- console . log ( checkPasswordComplexity (" abcdefgh9" ).value ) ; // medium
39
+ checkPasswordComplexity (" abcdefgh9" ).value ; // medium
45
40
46
- console . log ( checkPasswordComplexity (" abcdefgh9F=" ).value ) ; // strong
41
+ checkPasswordComplexity (" abcdefgh9F=" ).value ; // strong
47
42
48
43
```
49
44
50
45
## Result
51
46
52
- | property | type | Description |
47
+ | Property | Type | Description |
53
48
| ----------------| -------------------------------| -----------------------------|
54
49
|value|` tooWeak, weak, medium, strong ` | Too Weak, Weak, Medium or Strong
55
50
|checkedRules|` (minLength, lowercase, uppercase, number, specialCharacter)[] ` | List of all checked values
@@ -58,25 +53,28 @@ console.log(checkPasswordComplexity("abcdefgh9F=").value); // strong
58
53
<br />
59
54
60
55
``` tsx
61
- console . log ( checkPasswordComplexity (" abcdefg" ) );
56
+ checkPasswordComplexity (" abcdefg" );
62
57
/**
63
58
checkedRules: ['lowercase']
64
59
length: 7
65
60
value: "tooWeak"
66
61
*/
67
- console .log (checkPasswordComplexity (" abcdefg8" ));
62
+
63
+ checkPasswordComplexity (" abcdefg8" );
68
64
/**
69
65
checkedRules: ['lowercase', 'number']
70
66
length: 8
71
67
value: "weak"
72
68
*/
73
- console .log (checkPasswordComplexity (" abcdefgh9" ));
69
+
70
+ checkPasswordComplexity (" abcdefgh9" );
74
71
/**
75
72
checkedRules: ['minLength', 'lowercase', 'number']
76
73
length: 9
77
74
value: "medium"
78
75
*/
79
- console .log (checkPasswordComplexity (" abcdefgh9F=" ));
76
+
77
+ checkPasswordComplexity (" abcdefgh9F=" );
80
78
/**
81
79
checkedRules: ['minLength', 'lowercase', 'uppercase', 'number', 'specialCharacter']
82
80
length: 11
@@ -93,22 +91,26 @@ console.log(checkPasswordComplexity("abcdefgh9F=").value); // strong
93
91
<br />
94
92
95
93
``` tsx
96
- console . log ( checkPasswordComplexity (" abcdefg" , { minLength: 6 }) );
94
+ checkPasswordComplexity (" abcdefg" , { minLength: 6 });
97
95
/**
98
96
checkedRules: ['minLength', 'lowercase']
99
97
length: 7
100
98
value: "weak"
101
99
*/
102
100
103
101
// example: "." is the special character to be allowed
104
- console . log ( checkPasswordComplexity (" abcdefg." , { allowedSpecialChar: " ." }) );
102
+ checkPasswordComplexity (" abcdefg." , { allowedSpecialChar: " ." });
105
103
/**
106
104
checkedRules: ['lowercase', 'specialCharacter']
107
105
length: 8
108
106
value: "weak"
109
107
*/
110
108
```
111
109
110
+ ## Libraries using ` check-password-complexity `
111
+ - [ password-strength-input] ( https://www.npmjs.com/package/password-strength-input )
112
+ - [ mui-password-strength-input] ( https://www.npmjs.com/package/mui-password-strength-input )
113
+
112
114
## Contributing
113
115
Contributions & pull requests are welcome!
114
116
Get started [ here] ( https://github.com/tiavina-mika/check-password-complexity/blob/main/CONTRIBUTING.md ) .
0 commit comments