Skip to content

Commit 98748bc

Browse files
committed
perf: reorganize isChar for speed
1 parent 334f946 commit 98748bc

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/xml/1.0/ed5.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,10 @@ export const S_LIST = [SPACE, NL, CR, TAB];
5555
* @returns ``true`` if the codepoint matches ``CHAR``.
5656
*/
5757
export function isChar(c: number): boolean {
58-
return (c === TAB ||
59-
c === NL ||
60-
c === CR ||
61-
(c >= SPACE && c <= 0xD7FF) ||
62-
(c >= 0xE000 && c <= 0xFFFD) ||
63-
(c >= 0x10000 && c <= 0x10FFFF));
58+
return (c > SPACE && c <= 0xD7FF) ||
59+
S_LIST.includes(c) ||
60+
(c >= 0xE000 && c <= 0xFFFD) ||
61+
(c >= 0x10000 && c <= 0x10FFFF);
6462
}
6563

6664
/**

0 commit comments

Comments
 (0)