or run

npx @tessl/cli init
Log in

Version

Files

docs

index.md
tile.json

task.mdevals/scenario-5/

Unicode Host Converter

Build a module that converts punycoded domain names and email addresses into their Unicode form while leaving non-punycoded parts untouched.

Capabilities

Decodes domain labels to Unicode

  • shop.xn--caf-dma.com becomes shop.café.com, and legacy dot separators (such as or ) are treated the same as . during conversion @test

Leaves plain or already-decoded input unchanged

  • Inputs already in ASCII or Unicode (for example, bücher.de or example.com) are returned unchanged, even when the conversion is applied repeatedly @test

Converts only the email domain

  • alice@xn--xmpl-loa.test becomes alice@exämple.test while preserving the local part exactly as provided @test

Rejects malformed punycode labels

  • Any input containing an invalid punycode label (for example, xn--invalid_domain) results in a thrown RangeError @test

Implementation

@generates

API

/**
 * Converts a domain name string to its Unicode form, normalizing legacy separators and decoding punycoded labels; throws RangeError for malformed punycode.
 */
export function toUnicodeDomain(input);

/**
 * Converts only the domain portion of an email address to Unicode while leaving the local part unchanged; throws RangeError for malformed punycode labels.
 */
export function toUnicodeEmail(input);

Dependencies { .dependencies }

punycode { .dependency }

Provides Punycode-based domain and email conversions.