aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-22 15:46:23 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-01-24 20:15:25 -0500
commitbe2e6e0d9361e844c39bb3e48a3777db0ef52f67 (patch)
tree7aac99d379e5dd62c7b1941ca31ce281746aea0e /ext
parentfb6e56b3b75d49415e24f9c3d5489ce1482863b1 (diff)
Optimize jpIsKanji and jpIsKana
Diffstat (limited to 'ext')
-rw-r--r--ext/mixed/js/japanese.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/mixed/js/japanese.js b/ext/mixed/js/japanese.js
index 26349094..44db4b8c 100644
--- a/ext/mixed/js/japanese.js
+++ b/ext/mixed/js/japanese.js
@@ -78,11 +78,18 @@ const jpHalfWidthCharacterMapping = new Map([
function jpIsKanji(c) {
const code = c.charCodeAt(0);
- return code >= 0x4e00 && code < 0x9fb0 || code >= 0x3400 && code < 0x4dc0;
+ return (
+ (code >= 0x4e00 && code < 0x9fb0) ||
+ (code >= 0x3400 && code < 0x4dc0)
+ );
}
function jpIsKana(c) {
- return wanakana.isKana(c);
+ const code = c.charCodeAt(0);
+ return (
+ (code >= 0x3041 && code <= 0x3096) || // hiragana
+ (code >= 0x30a1 && code <= 0x30fc) // katakana
+ );
}
function jpIsJapaneseText(text) {