make eslint happy
also add some types to `chiptune2.ts`
This commit is contained in:
parent
e0afeff248
commit
fa60c1d4bf
3 changed files with 16 additions and 12 deletions
|
|
@ -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, '냥');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue