MCPcopy Index your code
hub / github.com/nodejs/node / percentDecode

Function percentDecode

deps/undici/undici.js:4431–4449  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

4429 }
4430 __name(hexByteToNumber, "hexByteToNumber");
4431 function percentDecode(input) {
4432 const length = input.length;
4433 const output = new Uint8Array(length);
4434 let j = 0;
4435 let i = 0;
4436 while (i < length) {
4437 const byte = input[i];
4438 if (byte !== 37) {
4439 output[j++] = byte;
4440 } else if (byte === 37 && !(isHexCharByte(input[i + 1]) && isHexCharByte(input[i + 2]))) {
4441 output[j++] = 37;
4442 } else {
4443 output[j++] = hexByteToNumber(input[i + 1]) << 4 | hexByteToNumber(input[i + 2]);
4444 i += 2;
4445 }
4446 ++i;
4447 }
4448 return length === j ? output : output.subarray(0, j);
4449 }
4450 __name(percentDecode, "percentDecode");
4451 function parseMIMEType(input) {
4452 input = removeHTTPWhitespace(input, true, true);

Callers 1

stringPercentDecodeFunction · 0.70

Calls 2

isHexCharByteFunction · 0.70
hexByteToNumberFunction · 0.70

Tested by

no test coverage detected