Skip to content

Commit

Permalink
getCount
Browse files Browse the repository at this point in the history
  • Loading branch information
PheRum committed Jun 13, 2024
1 parent 83ae871 commit 4031e30
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
9 changes: 9 additions & 0 deletions 7_kyu/Vowel Count/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Vowel Count

https://www.codewars.com/kata/54ff3102c1bad923760001f3

Return the number (count) of vowels in the given string.

We will consider a, e, i, o, u as vowels for this Kata (but not y).

The input string will only consist of lower case letters and/or spaces.
7 changes: 7 additions & 0 deletions 7_kyu/Vowel Count/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { getCount } from "./index";

describe("Tests", () => {
it("example", () => {
expect(getCount("abracadabra")).toBe(5);
});
});
5 changes: 5 additions & 0 deletions 7_kyu/Vowel Count/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export function getCount(str: string) {
const allowed = ["a", "e", "i", "o", "u"];

return str.split("").filter((l) => allowed.includes(l)).length;
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

### Katas solved

`Total`: 57 \
`Total`: 58 \
`8_kyu`: 51 \
`7_kyu`: 2 \
`7_kyu`: 3 \
`6_kyu`: 4 \
`5_kyu`: 0 \
`4_kyu`: 0 \
Expand Down
1 change: 0 additions & 1 deletion kata.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
8 kyu - Convert a string to an array - https://www.codewars.com/kata/57e76bc428d6fbc2d500036d
8 kyu - Fake Binary - https://www.codewars.com/kata/57eae65a4321032ce000002d
8 kyu - Calculate BMI - https://www.codewars.com/kata/57a429e253ba3381850000fb
7 kyu - Vowel Count - https://www.codewars.com/kata/54ff3102c1bad923760001f3
8 kyu - All Star Code Challenge #18 - https://www.codewars.com/kata/5865918c6b569962950002a1
8 kyu - Sentence Smash - https://www.codewars.com/kata/53dc23c68a0c93699800041d
7 kyu - Disemvowel Trolls - https://www.codewars.com/kata/52fba66badcd10859f00097e
Expand Down

0 comments on commit 4031e30

Please sign in to comment.