diff options
| author | Terry Truong <terry06890@gmail.com> | 2022-07-05 03:11:01 +1000 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2022-07-05 10:57:53 +1000 |
| commit | 1d443d39a5dda4c6993e03aeb1384e8c1e17205b (patch) | |
| tree | f45675c269c5884a4846d4b8840d90eb2e511f2c /src/util.ts | |
| parent | 9e8e30c5c680ca81862e4fba5f7ae9ecea62b8ff (diff) | |
Add images to help information
Diffstat (limited to 'src/util.ts')
| -rw-r--r-- | src/util.ts | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/util.ts b/src/util.ts index 034879e..142e8eb 100644 --- a/src/util.ts +++ b/src/util.ts @@ -135,6 +135,7 @@ export function randWeightedChoice(weights: number[]): number | null { export function capitalizeWords(str: string){ str = str.replace(/\b\w/g, x => x.toUpperCase()); // '\b' matches word boundary, '\w' is like [a-zA-Z0-9_] str = str.replace(/(\w)'S/, '$1\'s'); // Avoid cases like "traveler's tree" -> "Traveler'S Tree" + str = str.replace(/ And\b/, ' and'); // Avoid cases like "frogs and toads" -> "Frogs And Toads" return str; } // Used to async-await for until after a timeout |
