diff options
author | 2021-09-14 19:58:52 +0200 | |
---|---|---|
committer | 2021-09-14 19:58:52 +0200 | |
commit | 95df3522a15631abc51a4295cae0ea401a8d4e1e (patch) | |
tree | e5eb0f368c947683f01458e912f21756fb0d99cb /packages/forms/src/input | |
parent | docs: add sad270 as a contributor for bug, userTesting [skip ci] (#1941) (diff) | |
download | ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.tar.gz ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.tar.zst ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.zip |
feat: add eslint-plugin-unicorn (#1936)
Diffstat (limited to 'packages/forms/src/input')
-rw-r--r-- | packages/forms/src/input/scorePassword.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/packages/forms/src/input/scorePassword.ts b/packages/forms/src/input/scorePassword.ts index bc30de4b8..59502e2b0 100644 --- a/packages/forms/src/input/scorePassword.ts +++ b/packages/forms/src/input/scorePassword.ts | |||
@@ -18,9 +18,9 @@ export function scorePasswordFunc(password: string): number { | |||
18 | 18 | ||
19 | // award every unique letter until 5 repetitions | 19 | // award every unique letter until 5 repetitions |
20 | const letters: ILetters = {}; | 20 | const letters: ILetters = {}; |
21 | for (let i = 0; i < password.length; i += 1) { | 21 | for (const element of password) { |
22 | letters[password[i]] = (letters[password[i]] || 0) + 1; | 22 | letters[element] = (letters[element] || 0) + 1; |
23 | score += 5.0 / letters[password[i]]; | 23 | score += 5 / letters[element]; |
24 | } | 24 | } |
25 | 25 | ||
26 | // bonus points for mixing it up | 26 | // bonus points for mixing it up |
@@ -32,9 +32,9 @@ export function scorePasswordFunc(password: string): number { | |||
32 | }; | 32 | }; |
33 | 33 | ||
34 | let variationCount = 0; | 34 | let variationCount = 0; |
35 | Object.keys(variations).forEach(key => { | 35 | for (const key of Object.keys(variations)) { |
36 | variationCount += variations[key] === true ? 1 : 0; | 36 | variationCount += variations[key] === true ? 1 : 0; |
37 | }); | 37 | } |
38 | 38 | ||
39 | score += (variationCount - 1) * 10; | 39 | score += (variationCount - 1) * 10; |
40 | 40 | ||