js-generate-password 0.0.1 → 0.0.2
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.
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<!-- prettier-ignore-start -->
|
|
2
|
+
<!-- SOMETHING AUTO-GENERATED BY TOOLS - START -->
|
|
3
|
+
|
|
4
|
+
# js-generate-password
|
|
5
|
+
|
|
6
|
+
js-generate-password is usable for every javascript based project like react, vue, node, etc. it used to generate passwords that may contain alphabets, number and symbols. The options parameter enables the user to enable or disable the characters that are used to generate random password.
|
|
7
|
+
|
|
8
|
+
The characters that may be choosen from are
|
|
9
|
+
|
|
10
|
+
- Lowercase Characters
|
|
11
|
+
- Uppercase Characters
|
|
12
|
+
- Numbers
|
|
13
|
+
- Symbols
|
|
14
|
+
|
|
15
|
+
The user may also specify the minimum number of character for each type.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
`npm install js-generate-password`
|
|
20
|
+
or
|
|
21
|
+
`yarn add js-generate-password`
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
For the password to be generated, **parameters** are able to pass as an optional **options** object.
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
import PasswordGenerator from "js-generate-password";
|
|
29
|
+
const password = PasswordGenerator({
|
|
30
|
+
length: 14,
|
|
31
|
+
symbols: true,
|
|
32
|
+
});
|
|
33
|
+
console.log(password);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
If no parameter is passed, the default parameter will be taken as :
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
options = {
|
|
40
|
+
length: 10,
|
|
41
|
+
lowercase: true,
|
|
42
|
+
uppercase: true,
|
|
43
|
+
numbers: true,
|
|
44
|
+
symbols: false,
|
|
45
|
+
exclude: "",
|
|
46
|
+
minLengthLowercase: 1,
|
|
47
|
+
minLengthUppercase: 1,
|
|
48
|
+
minLengthNumbers: 1,
|
|
49
|
+
minLengthSymbols: 0,
|
|
50
|
+
};
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Available options
|
|
54
|
+
|
|
55
|
+
Any of these can be passed into the options object for each function.
|
|
56
|
+
|
|
57
|
+
| Name | Description | Default Value |
|
|
58
|
+
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
|
|
59
|
+
| length | Integer, length of password. | 10 |
|
|
60
|
+
| lowercase\* | Boolean, put lowercase letters in password | true |
|
|
61
|
+
| uppercase\* | Boolean, put uppercase letters in password. | true |
|
|
62
|
+
| numbers\* | Boolean, put numbers in password. | true |
|
|
63
|
+
| symbols\* | Boolean, put symbols in password. | false |
|
|
64
|
+
| exclude | String, characters to be excluded from password. | '' |
|
|
65
|
+
| minLengthLowercase | only if **lowercase** is set to **true**, minLengthLowercase will create a password that will have minimum number of lower case characters in the password. | 1 |
|
|
66
|
+
| minLengthUppercase | only if **uppercase** is set to **true**, minLengthUppercase will create a password that will have minimum number of upper case characters in the password. | 1 |
|
|
67
|
+
| minLengthNumbers | only if **numbers** is set to **true**, minLengthNumbers will create a password that will have minimum number of numbers in the password. | 1 |
|
|
68
|
+
| minLengthSymbols | only if **symbols** is set to **true**, minLengthSymbols will create a password that will have minimum number of symbols in the password. | 1 |
|
|
69
|
+
|
|
70
|
+
\*At least one should be true.
|
|
71
|
+
|
|
72
|
+
## Example
|
|
73
|
+
|
|
74
|
+
- **No Options passed.**
|
|
75
|
+
|
|
76
|
+
```javscript
|
|
77
|
+
const PasswordGenerator = require("js-generate-password");
|
|
78
|
+
const password = PasswordGenerator();
|
|
79
|
+
console.log(password);
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
In the above case, no parameter is passed as option. Therefore the default values will be taken - which will have alphabets, both upper and lower case, numbers, and will be of length 10 characters.
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
xDU6izb3PV;
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
- **Length parameter passed.**
|
|
89
|
+
|
|
90
|
+
```javascript
|
|
91
|
+
options={
|
|
92
|
+
length : 25;
|
|
93
|
+
}
|
|
94
|
+
password = PasswordGenerator(options);
|
|
95
|
+
console.log(password);
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The password generated is
|
|
99
|
+
|
|
100
|
+
```javascript
|
|
101
|
+
U4c3KpQP5UrbZgTcrqMgFeI3R;
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
- **exclude parameter passed.**
|
|
105
|
+
|
|
106
|
+
```javascript
|
|
107
|
+
options={
|
|
108
|
+
exclude : 'abc567XYZ';
|
|
109
|
+
}
|
|
110
|
+
password = PasswordGenerator(options);
|
|
111
|
+
console.log(password);
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The generated password wouldn't has none of 'abc567XYZ' characters
|
|
115
|
+
|
|
116
|
+
```javascript
|
|
117
|
+
J9yCfttQNj;
|
|
118
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "js-generate-password",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Password Generator for using in javascirpt/typscript based projects.",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"bin": "index.js",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/ahmadjoya/js-generate-password.git"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"js password generator",
|
|
17
|
+
"generate password",
|
|
18
|
+
"password generator",
|
|
19
|
+
"random password",
|
|
20
|
+
"password",
|
|
21
|
+
"generator",
|
|
22
|
+
"unique",
|
|
23
|
+
"nodejs",
|
|
24
|
+
"nextjs",
|
|
25
|
+
"react",
|
|
26
|
+
"reactjs",
|
|
27
|
+
"random"
|
|
28
|
+
],
|
|
29
|
+
"author": "Ahmad Joya",
|
|
30
|
+
"license": "ISC",
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/ahmadjoya/js-generate-password/issues"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/ahmadjoya/js-generate-password#readme"
|
|
35
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "js-generate-password",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Password Generator for using in javascirpt/typscript based projects.",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"bin": "index.js",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/ahmadjoya/js-generate-password.git"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"js password generator",
|
|
17
|
+
"generate password",
|
|
18
|
+
"password generator",
|
|
19
|
+
"random password",
|
|
20
|
+
"password",
|
|
21
|
+
"generator",
|
|
22
|
+
"unique",
|
|
23
|
+
"nodejs",
|
|
24
|
+
"nextjs",
|
|
25
|
+
"react",
|
|
26
|
+
"reactjs",
|
|
27
|
+
"random"
|
|
28
|
+
],
|
|
29
|
+
"author": "Ahmad Joya",
|
|
30
|
+
"license": "ISC",
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/ahmadjoya/js-generate-password/issues"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/ahmadjoya/js-generate-password#readme"
|
|
35
|
+
}
|
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<!-- prettier-ignore-start -->
|
|
2
2
|
<!-- SOMETHING AUTO-GENERATED BY TOOLS - START -->
|
|
3
3
|
|
|
4
|
-
#
|
|
4
|
+
# js-generate-password
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
js-generate-password is usable for every javascript based project like react, vue, node, etc. it used to generate passwords that may contain alphabets, number and symbols. The options parameter enables the user to enable or disable the characters that are used to generate random password.
|
|
7
7
|
|
|
8
8
|
The characters that may be choosen from are
|
|
9
9
|
|
|
@@ -16,16 +16,16 @@ The user may also specify the minimum number of character for each type.
|
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
|
-
`npm install
|
|
19
|
+
`npm install js-generate-password`
|
|
20
20
|
or
|
|
21
|
-
`yarn add
|
|
21
|
+
`yarn add js-generate-password`
|
|
22
22
|
|
|
23
23
|
## Usage
|
|
24
24
|
|
|
25
25
|
For the password to be generated, **parameters** are able to pass as an optional **options** object.
|
|
26
26
|
|
|
27
27
|
```javascript
|
|
28
|
-
import PasswordGenerator from "
|
|
28
|
+
import PasswordGenerator from "js-generate-password";
|
|
29
29
|
const password = PasswordGenerator({
|
|
30
30
|
length: 14,
|
|
31
31
|
symbols: true,
|
|
@@ -74,7 +74,7 @@ Any of these can be passed into the options object for each function.
|
|
|
74
74
|
- **No Options passed.**
|
|
75
75
|
|
|
76
76
|
```javscript
|
|
77
|
-
const PasswordGenerator = require("
|
|
77
|
+
const PasswordGenerator = require("js-generate-password");
|
|
78
78
|
const password = PasswordGenerator();
|
|
79
79
|
console.log(password);
|
|
80
80
|
```
|