Skip to content

Commit 16b5c49

Browse files
fix: formatting
1 parent 86870f8 commit 16b5c49

File tree

3 files changed

+28
-26
lines changed

3 files changed

+28
-26
lines changed

src/components/safeDoc-react/NewDocDialog.tsx

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,18 @@ export function NewDocDialog({
2424
() =>
2525
createRandom(
2626
Math.ceil(
27-
passwordGenerators.reduce((maxNeeded, { entropyNeeded }) => Math.max(maxNeeded, entropyNeeded), 0) / 8
28-
)
27+
passwordGenerators.reduce(
28+
(maxNeeded, { entropyNeeded }) =>
29+
Math.max(maxNeeded, entropyNeeded),
30+
0,
31+
) / 8,
32+
),
2933
),
3034
[lastRefresh],
3135
);
32-
const passwordGenerator = useMemo(
33-
() => {
34-
return passwordGenerators[idType]
35-
},
36-
[idType],
37-
);
36+
const passwordGenerator = useMemo(() => {
37+
return passwordGenerators[idType];
38+
}, [idType]);
3839
const password = useMemo(
3940
() => passwordGenerator.getRandom(random()),
4041
[random, passwordGenerator],
@@ -51,7 +52,10 @@ export function NewDocDialog({
5152
onChange={(e) => {
5253
const typeForm = e.currentTarget.elements;
5354
setIdType(
54-
parseInt((typeForm["idType" as any] as any as RadioNodeList).value, 10),
55+
parseInt(
56+
(typeForm["idType" as any] as any as RadioNodeList).value,
57+
10,
58+
),
5559
);
5660
setType(
5761
types.find((type) => {
@@ -108,18 +112,16 @@ export function NewDocDialog({
108112
enter. Choose as you like.
109113
</p>
110114
<div style={{ display: "flex", flexDirection: "column" }}>
111-
{
112-
passwordGenerators.map(({ humanName }, num) =>
113-
<InputWithLabel
114-
type="radio"
115-
name="idType"
116-
key={num}
117-
value={num}
118-
label={humanName}
119-
defaultChecked={num === 0}
120-
/>
121-
)
122-
}
115+
{passwordGenerators.map(({ humanName }, num) => (
116+
<InputWithLabel
117+
type="radio"
118+
name="idType"
119+
key={num}
120+
value={num}
121+
label={humanName}
122+
defaultChecked={num === 0}
123+
/>
124+
))}
123125
</div>
124126
<InputWithLabel
125127
type="text"

src/utils/password-base32.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ class RandomBase32 implements PasswordGenerator {
2323
entropyNeeded: number;
2424
entropyProvided: number;
2525

26-
constructor(public humanName: string, bytes: number) {
26+
constructor(
27+
public humanName: string,
28+
bytes: number,
29+
) {
2730
const bits = bytes * 8;
2831
const buffer = new Uint8Array(bytes);
2932
this.buffer = buffer;

src/utils/password-generators.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
import { passwordBase32 } from "@/utils/password-base32";
22
import { passwordWords } from "@/utils/password-dict-words";
33

4-
export const passwordGenerators = [
5-
passwordBase32,
6-
passwordWords,
7-
];
4+
export const passwordGenerators = [passwordBase32, passwordWords];

0 commit comments

Comments
 (0)