Skip to main content
Deno 2 is finally here 🎉️
Learn more

deno_domain

tag Build Status license

Get all the top-level domains, including gTLDs such as .com, and country-code TLDs such as .uk.

Usage

All domain code:

import domains from "https://deno.land/x/domain/domains.ts";

console.log(domains);

output:

[
  [".aaa", ".aaa", "generic", "American Automobile Association, Inc."],
  [".aarp", ".aarp", "generic", "AARP"],
  [".abarth", ".abarth", "generic", "Fiat Chrysler Automobiles N.V."],
  [".abb", ".abb", "generic", "ABB Ltd"],
  ...
  ...

Check if the domain code is valid:

import { isValid } from "https://deno.land/x/domain/mod.ts";

isValid(".com"); // true
isValid(".cn"); // true
isValid(".zzzzz"); // false

Get an array with all the domain codes supported:

import { getAlldomainCode } from "https://deno.land/x/domain/mod.ts";

getAlldomainCode(); // [".aaa", ".aarp", ".abarth", ..., ...]

Get domainInfo:

import { getdomainInfo } from "https://deno.land/x/domain/mod.ts";

getdomainInfo(".com");
// { name: ".com", xn: ".com", type: "generic", manager: "VeriSign Global Registry Services" }

getdomainInfo(".中国");
// { name: ".中国", xn: ".xn--fiqs8s", type: "country-code", manager: "China Internet Network Information Center (CNNIC)" }

getdomainInfo(".zzzz");
// null

License

deno_domain is released under the MIT License. See the bundled LICENSE file for details.