(domainName, options)
| 3313 | return regexes.bidiDomain.test(domain); |
| 3314 | } |
| 3315 | function processing(domainName, options) { |
| 3316 | let string = mapChars(domainName, options); |
| 3317 | string = string.normalize("NFC"); |
| 3318 | const labels = string.split("."); |
| 3319 | const isBidi = isBidiDomain(labels); |
| 3320 | let error = false; |
| 3321 | for (const [i3, origLabel] of labels.entries()) { |
| 3322 | let label = origLabel; |
| 3323 | let transitionalProcessingForThisLabel = options.transitionalProcessing; |
| 3324 | if (label.startsWith("xn--")) { |
| 3325 | if (containsNonASCII(label)) { |
| 3326 | error = true; |
| 3327 | continue; |
| 3328 | } |
| 3329 | try { |
| 3330 | label = punycode.decode(label.substring(4)); |
| 3331 | } catch { |
| 3332 | if (!options.ignoreInvalidPunycode) { |
| 3333 | error = true; |
| 3334 | continue; |
| 3335 | } |
| 3336 | } |
| 3337 | labels[i3] = label; |
| 3338 | if (label === "" || !containsNonASCII(label)) { |
| 3339 | error = true; |
| 3340 | } |
| 3341 | transitionalProcessingForThisLabel = false; |
| 3342 | } |
| 3343 | if (error) { |
| 3344 | continue; |
| 3345 | } |
| 3346 | const validation = validateLabel(label, { |
| 3347 | ...options, |
| 3348 | transitionalProcessing: transitionalProcessingForThisLabel, |
| 3349 | isBidi |
| 3350 | }); |
| 3351 | if (!validation) { |
| 3352 | error = true; |
| 3353 | } |
| 3354 | } |
| 3355 | return { |
| 3356 | string: labels.join("."), |
| 3357 | error |
| 3358 | }; |
| 3359 | } |
| 3360 | function toASCII(domainName, { |
| 3361 | checkHyphens = false, |
| 3362 | checkBidi = false, |
no test coverage detected
searching dependent graphs…