perf: Fix minor perf issue for JS
This commit is contained in:
@@ -374,10 +374,11 @@ pub fn parse_hex_digit(str: String) -> Result(#(String, String), Nil) {
|
||||
case string.pop_grapheme(str) {
|
||||
Ok(#(char, tail)) -> {
|
||||
let assert [codepoint] = string.to_utf_codepoints(char)
|
||||
case string.utf_codepoint_to_int(codepoint) {
|
||||
i if i >= 0x30 && i <= 0x39 -> Ok(#(char, tail))
|
||||
i if i >= 0x41 && i <= 0x46 -> Ok(#(char, tail))
|
||||
i if i >= 0x61 && i <= 0x66 -> Ok(#(char, tail))
|
||||
let i = string.utf_codepoint_to_int(codepoint)
|
||||
case i {
|
||||
_ if i >= 0x30 && i <= 0x39 -> Ok(#(char, tail))
|
||||
_ if i >= 0x41 && i <= 0x46 -> Ok(#(char, tail))
|
||||
_ if i >= 0x61 && i <= 0x66 -> Ok(#(char, tail))
|
||||
_ -> Error(Nil)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user