MCPcopy Create free account
hub / github.com/sindresorhus/query-string / percentByte

Function percentByte

test/parse.js:1385–1385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1383test('a value with many distinct percent-encodings decodes the same with and without an invalid sequence', () => {
1384 // A value that is valid percent-encoded UTF-8 is decoded by the built-in decoder. Adding one invalid sequence makes it throw, and the value is then decoded the lenient way instead. Both paths have to give the same characters, so this covers a value with thousands of distinct escapes going through the lenient path.
1385 const percentByte = value => `%${value.toString(16).toUpperCase().padStart(2, '0')}`;
1386
1387 // Distinct three-byte sequences. Lead bytes 0xE0 and 0xED are left out, because they only allow part of the second-byte range: below 0xA0, 0xE0 begins an overlong encoding, and above 0x9F, 0xED begins a surrogate. Every second byte the loop below makes is then valid.
1388 const runs = [];

Callers 2

parse.jsFile · 0.85
distinctEncodingsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected