Optimize jpIsKanji and jpIsKana

This commit is contained in:
toasted-nutbread 2019-12-22 15:46:23 -05:00
parent fb6e56b3b7
commit be2e6e0d93

View File

@ -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) {