mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-23 20:49:06 +01:00
01a3e47d9b
* Disable Nyaize in quote * mfmを文字列に戻す、nyaizeにmfmを使用 * Revert "Disable Nyaize in quote" This reverts commit 1b238905a5535267d32d7e1aec8afd8bb07b0619. * refactor * use return type as string
14 lines
507 B
TypeScript
14 lines
507 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.charCodeAt(0)! + '냐'.charCodeAt(0) - '나'.charCodeAt(0)
|
|
))
|
|
.replace(/(다$)|(다(?=\.))|(다(?= ))|(다(?=!))|(다(?=\?))/gm, '다냥')
|
|
.replace(/(야(?=\?))|(야$)|(야(?= ))/gm, '냥');
|
|
}
|