Library to work against complex domain names, subdomains and URIs
82
{
"context": "This criteria evaluates how effectively the engineer uses the tldts library to extract subdomain information from URLs and hostnames. The focus is on proper usage of tldts functions and handling of the library's return values.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Uses getSubdomain function",
"description": "Uses the tldts.getSubdomain() function to extract subdomains from URLs or hostnames",
"max_score": 30
},
{
"name": "Imports tldts correctly",
"description": "Correctly imports the tldts library using require() or import statement at the beginning of the module",
"max_score": 10
},
{
"name": "Handles null returns",
"description": "Properly handles null return values from getSubdomain() when parsing fails or input is invalid, converting them to empty strings or marking as invalid",
"max_score": 20
},
{
"name": "Single URL analysis",
"description": "Implements analyzeSubdomain() function that correctly processes a single URL/hostname and returns an object with url, subdomain, and isValid fields",
"max_score": 15
},
{
"name": "Batch URL analysis",
"description": "Implements analyzeSubdomains() function that correctly processes an array of URLs/hostnames by iterating and calling getSubdomain() for each",
"max_score": 15
},
{
"name": "Handles empty subdomains",
"description": "Correctly handles cases where getSubdomain() returns an empty string (for domains without subdomains) and preserves this value",
"max_score": 10
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-tldtsdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10