@nfrasser/simple-html-tokenizer
Version:
Simple HTML Tokenizer is a lightweight JavaScript library that can be used to tokenize the kind of HTML normally found in templates.
16 lines (12 loc) • 326 B
text/typescript
const WSP = /[\t\n\f ]/;
const ALPHA = /[A-Za-z]/;
const CRLF = /\r\n?/g;
export function isSpace(char: string): boolean {
return WSP.test(char);
}
export function isAlpha(char: string): boolean {
return ALPHA.test(char);
}
export function preprocessInput(input: string): string {
return input.replace(CRLF, '\n');
}