CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-punycode

A robust Punycode converter that fully complies to RFC 3492 and RFC 5891, and works on nearly all JavaScript platforms.

93

1.17x

Quality

Pending

Does it follow best practices?

Impact

93%

1.17x

Average score across 10 eval scenarios

Overview
Eval results
Files

task.mdevals/scenario-10/

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.

Install with Tessl CLI

npx tessl i tessl/npm-punycode

tile.json