mirror of
				https://github.com/monkeytypegame/monkeytype.git
				synced 2025-11-01 03:39:15 +08:00 
			
		
		
		
	converted to ts
This commit is contained in:
		
							parent
							
								
									a95b34b35f
								
							
						
					
					
						commit
						1c619b017e
					
				
					 1 changed files with 6 additions and 6 deletions
				
			
		|  | @ -1,9 +1,9 @@ | |||
| import { capitalizeFirstLetter } from "../misc"; | ||||
| 
 | ||||
| let list = null; | ||||
| let list: string[] = []; | ||||
| 
 | ||||
| export async function getList() { | ||||
|   if (list == null) { | ||||
| export async function getList(): Promise<string[]> { | ||||
|   if (list.length === 0) { | ||||
|     return $.getJSON("languages/britishenglish.json", function (data) { | ||||
|       list = data; | ||||
|       return list; | ||||
|  | @ -13,9 +13,9 @@ export async function getList() { | |||
|   } | ||||
| } | ||||
| 
 | ||||
| export async function replace(word) { | ||||
|   let list = await getList(); | ||||
|   let replacement = list.find((a) => | ||||
| export async function replace(word: string): Promise<string> { | ||||
|   const list = await getList(); | ||||
|   const replacement = list.find((a) => | ||||
|     word.match(RegExp(`^([\\W]*${a[0]}[\\W]*)$`, "gi")) | ||||
|   ); | ||||
|   return replacement | ||||
		Loading…
	
	Add table
		
		Reference in a new issue