CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-tldts

Library to work against complex domain names, subdomains and URIs

82

1.03x
Overview
Eval results
Files

rubric.jsonevals/scenario-6/

{
  "context": "This criteria evaluates how well the engineer uses the tldts library to handle edge cases in URL/hostname parsing, specifically focusing on malformed hostnames, unknown TLDs, and single-label hostnames. The evaluation assesses proper use of tldts parsing functions and correct interpretation of the result metadata.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Import tldts functions",
      "description": "Correctly imports necessary functions from tldts package (e.g., parse, getHostname, getDomain, getPublicSuffix). Must import at least parse() or equivalent functions to extract hostname, domain, and suffix information.",
      "max_score": 10
    },
    {
      "name": "Parse input URLs",
      "description": "Uses tldts parse() function or equivalent (getHostname, getDomain, etc.) to process the input URL or hostname string and extract components.",
      "max_score": 15
    },
    {
      "name": "Extract hostname correctly",
      "description": "Properly extracts and returns the hostname from parse result using result.hostname or getHostname() function. Should handle normalization automatically performed by tldts.",
      "max_score": 15
    },
    {
      "name": "Extract domain correctly",
      "description": "Properly extracts the domain from parse result using result.domain or getDomain() function. Should correctly handle cases where domain is null (e.g., for single-label hostnames or IPs).",
      "max_score": 15
    },
    {
      "name": "Extract public suffix",
      "description": "Properly extracts the public suffix/TLD from parse result using result.publicSuffix or getPublicSuffix() function. Should handle both known and unknown TLDs.",
      "max_score": 15
    },
    {
      "name": "Detect normalization requirement",
      "description": "Implements logic to detect if input required normalization by comparing original input with the parsed hostname, or by checking for leading/trailing dots or malformations in the input string.",
      "max_score": 15
    },
    {
      "name": "Detect known TLDs",
      "description": "Uses tldts metadata flags (result.isIcann or result.isPrivate) or checks if result.publicSuffix is non-null to determine if the TLD is recognized in the public suffix list.",
      "max_score": 15
    }
  ]
}

Install with Tessl CLI

npx tessl i tessl/npm-tldts

tile.json