@massimo-cassandro/minimo 1.7.1 → 1.7.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.
package/index.js CHANGED
@@ -7,6 +7,7 @@ export { disableBtnsOnSubmit } from './src/utilities/disable-btns-on-submit.js';
7
7
  export { domBuilder } from './src/utilities/dom-builder/dom-builder.js';
8
8
  export { enableSubmitBtns } from './src/utilities/enable-submit-btns.js';
9
9
  export { escapeHTML, unescapeHTML } from './src/utilities/escape-html.js';
10
+ export { generatePwd } from './src/utilities/generate-pwd.js';
10
11
  export { getCookie, setCookie } from './src/utilities/cookies.js';
11
12
  export { linkedDates } from './src/utilities/linked-dates.js';
12
13
  export { randomId } from './src/utilities/random-id.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/minimo",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "Light css framework & utilities",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Generates a random password using uppercase letters and digits,
3
+ * excluding visually ambiguous characters (O, I, 0).
4
+ *
5
+ * @param {number} [min_length=8] - Minimum password length (matches `minlength` attribute).
6
+ * @returns {string} The generated password.
7
+ */
8
+ export function generatePwd(min_length = 8) {
9
+
10
+ let chars='ABCDEFGHJKLMNPQRSTUVWXYZ123456789',
11
+ charsNum = chars.length,
12
+ min_lenght = min_length || 8,
13
+ pwd = '', i, x;
14
+
15
+ for( x = 0; x < min_lenght; x++ ) {
16
+ i = Math.floor(Math.random() * charsNum);
17
+ pwd += chars.charAt(i);
18
+ }
19
+
20
+ return pwd;
21
+
22
+ }