MCPcopy Create free account
hub / github.com/di-sukharev/opencommit / domainToASCII

Function domainToASCII

out/cli.cjs:3935–3957  ·  view source on GitHub ↗
(domain, beStrict = false)

Source from the content-addressed store, hash-verified

3933 return host;
3934 }
3935 function domainToASCII(domain, beStrict = false) {
3936 const result = tr46.toASCII(domain, {
3937 checkHyphens: beStrict,
3938 checkBidi: true,
3939 checkJoiners: true,
3940 useSTD3ASCIIRules: beStrict,
3941 transitionalProcessing: false,
3942 verifyDNSLength: beStrict,
3943 ignoreInvalidPunycode: false
3944 });
3945 if (result === null) {
3946 return failure;
3947 }
3948 if (!beStrict) {
3949 if (result === "") {
3950 return failure;
3951 }
3952 if (containsForbiddenDomainCodePoint(result)) {
3953 return failure;
3954 }
3955 }
3956 return result;
3957 }
3958 function trimControlChars(string) {
3959 let start = 0;
3960 let end = string.length;

Callers 1

parseHostFunction · 0.85

Calls 1

Tested by

no test coverage detected