| 269 | |
| 270 | // The byte that the percent escape at `position` stands for, or -1 when there is no escape there. A `%` that is not followed by two hexadecimal digits is not an escape, and neither is one that starts the value. |
| 271 | function readPercentByte(value, position) { |
| 272 | percentEscape.lastIndex = position; |
| 273 | const match = percentEscape.exec(value); |
| 274 | return match === null ? -1 : Number.parseInt(match[0].slice(1), 16); |
| 275 | } |
| 276 | |
| 277 | // The number of bytes in the UTF-8 sequence that starts with this lead byte, or zero when the byte cannot start one. That is a continuation byte (0x80 to 0xBF), and the lead bytes that are only ever invalid: 0xC0 and 0xC1 can only start an overlong encoding, and 0xF5 to 0xFF can only start a code point above U+10FFFF. |
| 278 | function utf8SequenceLength(leadByte) { |