diff options
| author | Aya Morisawa <AyaMorisawa4869@gmail.com> | 2018-09-12 03:51:33 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2018-09-12 03:51:33 +0900 |
| commit | 2118fadc48bd4e0756349bffff452426ee2d09c5 (patch) | |
| tree | 7e075f02a9b90504e740243a0edc158d1bdaf5d2 /src | |
| parent | Refactor (diff) | |
| download | sharkey-2118fadc48bd4e0756349bffff452426ee2d09c5.tar.gz sharkey-2118fadc48bd4e0756349bffff452426ee2d09c5.tar.bz2 sharkey-2118fadc48bd4e0756349bffff452426ee2d09c5.zip | |
Add toUpperCase function (#2697)
Diffstat (limited to 'src')
| -rw-r--r-- | src/mfm/parse/core/syntax-highlighter.ts | 4 | ||||
| -rw-r--r-- | src/prelude/string.ts | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/mfm/parse/core/syntax-highlighter.ts b/src/mfm/parse/core/syntax-highlighter.ts index c5157ca1d3..83aac89f1b 100644 --- a/src/mfm/parse/core/syntax-highlighter.ts +++ b/src/mfm/parse/core/syntax-highlighter.ts @@ -1,4 +1,4 @@ -import { capitalize } from "../../../prelude/string"; +import { capitalize, toUpperCase } from "../../../prelude/string"; function escape(text: string) { return text @@ -92,7 +92,7 @@ const _keywords = [ const keywords = _keywords .concat(_keywords.map(capitalize)) - .concat(_keywords.map(k => k.toUpperCase())) + .concat(_keywords.map(toUpperCase)) .sort((a, b) => b.length - a.length); const symbols = [ diff --git a/src/prelude/string.ts b/src/prelude/string.ts index 2b89304f16..8855adb905 100644 --- a/src/prelude/string.ts +++ b/src/prelude/string.ts @@ -1,3 +1,7 @@ export function capitalize(s: string): string { - return s.charAt(0).toUpperCase() + s.slice(1).toLowerCase(); + return toUpperCase(s.charAt(0)) + s.slice(1).toLowerCase(); +} + +export function toUpperCase(s: string): string { + return s.toUpperCase(); } |