UNPKG

784 BJavaScriptView Raw
1import {charCodes} from "./charcodes";
2
3// https://tc39.github.io/ecma262/#sec-white-space
4export const WHITESPACE_CHARS = [
5 0x0009,
6 0x000b,
7 0x000c,
8 charCodes.space,
9 charCodes.nonBreakingSpace,
10 charCodes.oghamSpaceMark,
11 0x2000, // EN QUAD
12 0x2001, // EM QUAD
13 0x2002, // EN SPACE
14 0x2003, // EM SPACE
15 0x2004, // THREE-PER-EM SPACE
16 0x2005, // FOUR-PER-EM SPACE
17 0x2006, // SIX-PER-EM SPACE
18 0x2007, // FIGURE SPACE
19 0x2008, // PUNCTUATION SPACE
20 0x2009, // THIN SPACE
21 0x200a, // HAIR SPACE
22 0x202f, // NARROW NO-BREAK SPACE
23 0x205f, // MEDIUM MATHEMATICAL SPACE
24 0x3000, // IDEOGRAPHIC SPACE
25 0xfeff, // ZERO WIDTH NO-BREAK SPACE
26];
27
28export const IS_WHITESPACE = new Uint8Array(65536);
29for (const char of WHITESPACE_CHARS) {
30 IS_WHITESPACE[char] = 1;
31}