Created
April 3, 2016 03:01
-
-
Save cympfh/7b66ba71cb6b6d05a9cc61ba04beac74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const | |
HIRA = 0, | |
KANA = 1, | |
CHIN = 2, | |
ALPH = 3, | |
NUMB = 4, | |
SYM1 = 10, | |
SYM2 = 20, | |
OTHR = 5; | |
var test = function (c) { | |
const p_hira = /[ぁ-ん ]/ | |
, p_kana = /[ァ-ヴァ-ンー゙゚]/ | |
, p_chin = /[亜-熙一-龠]/ /* 姑息 */ | |
, p_alph = /[a-zA-Z ]/ | |
, p_numb = /[0-9]/ | |
, p_sym1 = /[!\"\#\$\%\^'\(\)~=~:;|`{@`\[\{\}\]\.\,\?\</>\\_\-]/ | |
, p_sym2 = /[!?(){}ー〜・。、:;/\]/ | |
; | |
return p_hira.test(c) ? HIRA | |
: p_kana.test(c) ? KANA | |
: p_chin.test(c) ? CHIN | |
: p_alph.test(c) ? ALPH | |
: p_numb.test(c) ? NUMB | |
: p_sym1.test(c) ? SYM1 | |
: p_sym2.test(c) ? SYM2 | |
: OTHR; | |
}; | |
exports.jc = { | |
HIRA : HIRA, | |
KANA : KANA, | |
CHIN : CHIN, | |
ALPH : ALPH, | |
NUMB : NUMB, | |
OTHR : OTHR, | |
test : test | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment