test1/src/misc/nyaize.ts
syuilo 3c4bae763f Revert "Korean, English Nyaziation and special case exclusion (#5813)"
This reverts commit c110f0860e2ae7bc378c36f8eb6048956ebc3a28.
2020-02-05 20:56:28 +09:00

12 lines
376 B
TypeScript

export function nyaize(text: string): string {
return text
// ja-JP
.replace(/な/g, 'にゃ').replace(/ナ/g, 'ニャ').replace(/ナ/g, 'ニャ')
// en-US
.replace(/morning/gi, 'mornyan').replace(/everyone/gi, 'everynyan')
// ko-KR
.replace(/[나-낳]/g, match => String.fromCharCode(
match.codePointAt(0)! + '냐'.charCodeAt(0) - '나'.charCodeAt(0)
));
}