import { domainToUnicode } from "node:url";

/** Punycode → Unicode pour l'affichage ; la forme stockée reste l'ASCII. */
export function formatDomain(ascii: string): string {
  // `domainToUnicode` rend une chaîne vide quand l'entrée n'est pas un domaine
  // convertible : on retombe alors sur l'entrée telle quelle.
  const unicode = domainToUnicode(ascii);
  return unicode || ascii;
}
