From 0b6c9323dfc76b33682c97ab3bc8012e67d4da37 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 3 Sep 2018 11:41:24 +0900 Subject: [PATCH] Refactor --- src/utils/or.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/or.ts b/src/utils/or.ts index cc951de..09909b9 100644 --- a/src/utils/or.ts +++ b/src/utils/or.ts @@ -11,7 +11,7 @@ export default function(text: string, words: (string | RegExp)[]): boolean { * テキストの余分な部分を取り除く * 例えば「藍ちゃん好き!」のようなテキストを「好き」にする */ - function cleanup(text: string): string { + function denoise(text: string): string { text = text.trim() .replace(/[!!]+$/, '') .replace(/っ+$/, '') @@ -33,9 +33,9 @@ export default function(text: string, words: (string | RegExp)[]): boolean { } if (typeof word == 'string') { - return (text == word) || (cleanup(text) == word); + return (text == word) || (denoise(text) == word); } else { - return (word.test(text)) || (word.test(cleanup(text))); + return (word.test(text)) || (word.test(denoise(text))); } }); }