MCPcopy Index your code
hub / github.com/di-sukharev/opencommit / parseHost

Function parseHost

out/cli.cjs:3858–3877  ·  view source on GitHub ↗
(input, isOpaque = false)

Source from the content-addressed store, hash-verified

3856 return output;
3857 }
3858 function parseHost(input, isOpaque = false) {
3859 if (input[0] === "[") {
3860 if (input[input.length - 1] !== "]") {
3861 return failure;
3862 }
3863 return parseIPv6(input.substring(1, input.length - 1));
3864 }
3865 if (isOpaque) {
3866 return parseOpaqueHost(input);
3867 }
3868 const domain = utf8DecodeWithoutBOM(percentDecodeString(input));
3869 const asciiDomain = domainToASCII(domain);
3870 if (asciiDomain === failure) {
3871 return failure;
3872 }
3873 if (endsInANumber(asciiDomain)) {
3874 return parseIPv4(asciiDomain);
3875 }
3876 return asciiDomain;
3877 }
3878 function endsInANumber(input) {
3879 const parts = input.split(".");
3880 if (parts[parts.length - 1] === "") {

Calls 7

parseIPv6Function · 0.85
parseOpaqueHostFunction · 0.85
utf8DecodeWithoutBOMFunction · 0.85
percentDecodeStringFunction · 0.85
domainToASCIIFunction · 0.85
endsInANumberFunction · 0.85
parseIPv4Function · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…