Skip to content

Commit

Permalink
perf: reorganize isChar for speed
Browse files Browse the repository at this point in the history
  • Loading branch information
lddubeau committed Jun 21, 2019
1 parent 334f946 commit 98748bc
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/xml/1.0/ed5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ export const S_LIST = [SPACE, NL, CR, TAB];
* @returns ``true`` if the codepoint matches ``CHAR``.
*/
export function isChar(c: number): boolean {
return (c === TAB ||
c === NL ||
c === CR ||
(c >= SPACE && c <= 0xD7FF) ||
(c >= 0xE000 && c <= 0xFFFD) ||
(c >= 0x10000 && c <= 0x10FFFF));
return (c > SPACE && c <= 0xD7FF) ||
S_LIST.includes(c) ||
(c >= 0xE000 && c <= 0xFFFD) ||
(c >= 0x10000 && c <= 0x10FFFF);
}

/**
Expand Down

0 comments on commit 98748bc

Please sign in to comment.