Skip to content

deep-impact-or-something/node-domain-name-parser

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-domain-name-parser

A simple parser that breaks apart a domain name into its components

build status

install

npm

npm install domain-name-parser

usage

var parse = require('domain-name-parser')
  , d = parse('host.subdomain.domain.com')
  ;

console.log(
  d.tld            //"com" -- the first part on the right
  , d.sld          //"domain" -- the second part from the right
  , d.host         //"host" -- the left-most part
  , d.domainName   //"domain.com" -- always the commonly referred to part (sld + tld)
  , d.domain       //"subdomain.domain.com" -- everything except the host
  , d.level(3)     //"subdomain" -- specific domain level part, 1 based (tld is level 1)
);

license

MIT

About

Parse domain name into tld, sld, domain, domainName, host

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%