or run

npx @tessl/cli init
Log in

Version

Files

docs

index.md
tile.json

task.mdevals/scenario-1/

Domain Label Decoder

Create a utility that turns domain names or email addresses containing encoded Punycode labels into Unicode-friendly strings while leaving ordinary ASCII content untouched.

Capabilities

Decode punycoded domains

  • Converts a domain containing an encoded label (e.g., xn--bcher-kva.example.com) to Unicode while leaving ASCII labels unchanged. @test

Decode email domains

  • Converts only the domain portion of an email while preserving the local part (e.g., info@xn--caf-dma.com -> info@café.com). @test

Idempotent and validated decoding

  • Returns plain ASCII domains unchanged when no encoded labels are present. @test
  • Throws an error for malformed encoded labels (e.g., xn--invalid!) instead of silently returning input. @test

Implementation

@generates

API

export function decodeDomain(input) {
  /**
   * Converts domain names or email addresses containing encoded labels into Unicode strings.
   *
   * @param {string} input - Domain name or email address to process.
   * @returns {string} Unicode string with encoded labels decoded.
   * @throws {RangeError} When encoded labels are invalid.
   */
}

Dependencies { .dependencies }

punycode { .dependency }

Decodes encoded domain labels to Unicode. @satisfied-by