UNPKG

cross-platform-terminal-characters

Version:
24 lines (15 loc) 559 B
import{codepoints}from"./codepoints.js"; import{serializeHex}from"./serialize.js"; const getRegex=()=>{ const regexCodepoints=codepoints.map(serializeRegexCodepoint).join(""); return new RegExp(`[^${regexCodepoints}]`,"gu") }; const serializeRegexCodepoint=(codepoint)=>{ const hex=serializeHex(codepoint); return`\\u${hex}` }; export const regex=getRegex(); const getCharacters=()=>codepoints.map(serializeCodepoint); const serializeCodepoint=(codepoint)=>String.fromCodePoint(codepoint); export const characters=getCharacters(); export{codepoints};