Skip to content

Commit

Permalink
fix pw
Browse files Browse the repository at this point in the history
  • Loading branch information
ogroppo committed Sep 25, 2023
1 parent d3eed99 commit a4c48d8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# deverything

## 0.28.1

### Patch Changes

- fix random pw

## 0.28.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "deverything",
"version": "0.28.0",
"version": "0.28.1",
"description": "Everything you need for Dev",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down
9 changes: 9 additions & 0 deletions src/random/randomPassword.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { describe, it, expect } from "@jest/globals";
import { randomPassword } from "./randomPassword";

describe(`randomPassword`, () => {
it(`no args`, () => {
expect(randomPassword().length).toBeGreaterThan(9);
expect(randomPassword({ minChars: 19 }).length).toBeGreaterThan(19);
});
});
4 changes: 2 additions & 2 deletions src/random/randomPassword.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { randomArrayItem } from "./randomArrayItem";
import { randomHtmlColorName } from "./randomHtmlColorName";
import { randomInt } from "./randomInt";

export const randomPassword = () =>
randomHtmlColorName() + // So it has an upper case
export const randomPassword = ({ minChars = 9 }: { minChars?: number } = {}) =>
randomHtmlColorName().padEnd(minChars, "-") + // So it has an upper case, at least 9 charss
randomArrayItem(SPECIAL_CHARACTERS) + // So it has a special character
randomInt(11, 99); // So it has a number

0 comments on commit a4c48d8

Please sign in to comment.