summaryrefslogtreecommitdiff
path: root/packages/frontend/src/scripts/nyaize.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/frontend/src/scripts/nyaize.ts')
-rw-r--r--packages/frontend/src/scripts/nyaize.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/frontend/src/scripts/nyaize.ts b/packages/frontend/src/scripts/nyaize.ts
index 58ed88fed1..5e6fa298d1 100644
--- a/packages/frontend/src/scripts/nyaize.ts
+++ b/packages/frontend/src/scripts/nyaize.ts
@@ -9,9 +9,9 @@ const koRegex3 = /(야(?=\?))|(야$)|(야(?= ))/gm;
function ifAfter(prefix, fn) {
const preLen = prefix.length;
- const regex = new RegExp(prefix,'i');
- return (x,pos,string) => {
- return pos > 0 && string.substring(pos-preLen,pos).match(regex) ? fn(x) : x;
+ const regex = new RegExp(prefix, 'i');
+ return (x, pos, string) => {
+ return pos > 0 && string.substring(pos - preLen, pos).match(regex) ? fn(x) : x;
};
}
@@ -25,7 +25,7 @@ export function nyaize(text: string): string {
.replace(/one/gi, ifAfter('every', x => x === 'ONE' ? 'NYAN' : 'nyan'))
// ko-KR
.replace(koRegex1, match => String.fromCharCode(
- match.charCodeAt(0)! + '냐'.charCodeAt(0) - '나'.charCodeAt(0),
+ match.charCodeAt(0) + '냐'.charCodeAt(0) - '나'.charCodeAt(0),
))
.replace(koRegex2, '다냥')
.replace(koRegex3, '냥');