Skip to content

Commit

Permalink
Fix bug: incorrect capitalisation of mutation #233
Browse files Browse the repository at this point in the history
  • Loading branch information
ijdickinson committed Sep 28, 2020
1 parent 605dbb4 commit 32a57b3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/javascript/lang/welsh-name-mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const MUTATIONS = {
[/M(.*)/, 'F$1', 'i'],
[/G(.*)/, '$1', 'i'],
[/T(.*)/, 'D$1', 'i'],
[/Rh(.*)/, 'r$1', 'i'],
[/Rh(.*)/, 'R$1', 'i'],
[/B(.*)/, 'F$1', 'i'],
[/C(.*)/, 'G$1', 'i'],
[/D(.*)/, 'Dd$1', 'i'],
Expand Down Expand Up @@ -45,7 +45,10 @@ function mutate (name, preposition, mutations) {
for (const rule of mutations) {
if (name.match(rule[0])) {
return {
name: name.replace(rule[0], rule[1]),
name:
name
.replace(rule[0], rule[1])
.replace(/^\w/, char => char.toLocaleUpperCase()),
preposition: rule[2]
}
}
Expand Down

0 comments on commit 32a57b3

Please sign in to comment.