const isHalfWidth = ( text ) => text . match ( /[\u0000-\u00ff]/g ) ?. length == text . length ; const CJK = "\u2e80-\u2eff\u2f00-\u2fdf\u3040-\u309f\u30a0-\u30fa\u30fc-\u30ff\u3100-\u312f\u3200-\u32ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff" ; const SerialNumber = { hollow_circle_number : "①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳㉑㉒㉓㉔㉕㉖㉗㉘㉙㉚㉛㉜㉝㉞㉟㊱㊲㊳㊴㊵㊶㊷㊸㊹㊺㊻㊼㊽㊾㊿" , solid_circle_number : "❶❷❸❹❺❻❼❽❾❿⓫⓬⓭⓮⓯⓰⓱⓲⓳⓴" } ; const isCJK = ( text ) => text . match ( new RegExp ( `^[${ CJK }]*$` ) ) ? true : false ; const countWord = ( text ) : number => { const en = text . split ( /[^a-zA-Z]/ ) . filter ( k => k ) ; const zh = text . match ( new RegExp ( `[${ CJK }]` , "g" ) ) ?? [ ] ; return en . length + zh . length ; } ; const byteLength = ( text ) => { let length = 0 ; Array . from ( text ) . forEach ( char => { length += char . charCodeAt ( 0 ) > 255 ? 2 : 1 ; } ) ; return length ; } ; export { isHalfWidth , isCJK , countWord , CJK , byteLength , SerialNumber } ;