mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-11 18:04:27 +08:00
Allow British English to replace capitalised words (#2040)
This commit is contained in:
parent
816562b8d4
commit
1744d930c5
1 changed files with 10 additions and 1 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import { capitalizeFirstLetter } from "./misc";
|
||||
|
||||
let list = null;
|
||||
|
||||
export async function getList() {
|
||||
|
|
@ -13,5 +15,12 @@ export async function getList() {
|
|||
|
||||
export async function replace(word) {
|
||||
let list = await getList();
|
||||
return list[list.findIndex((a) => a[0] === word)]?.[1];
|
||||
var britishWord =
|
||||
list[list.findIndex((a) => a[0] === word.toLowerCase())]?.[1];
|
||||
if (typeof britishWord !== "undefined") {
|
||||
if (word.charAt(0) === word.charAt(0).toUpperCase()) {
|
||||
britishWord = capitalizeFirstLetter(britishWord);
|
||||
}
|
||||
}
|
||||
return britishWord;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue