lukeed

reverse-dns

Get the reverse domain name notation (or "reverse DNS") for a site.

#Install

$ npm install --save reverse-dns

#Usage

const reverseDns = require('reverse-dns');

reverseDns('https://foo.example.com');
//=> 'com.example.foo'

reverseDns('https://example.com');
//=> 'com.example.www'

reverseDns('https://example.com', {name: 'bar'});
//=> 'com.example.bar'

reverseDns('https://bar.example.com', {name: 'hello'});
//=> 'com.example.hello'

reverseDns('https://example.com', {glue: '-'});
//=> 'com-example-www'

#API

#reverseDns(input, [options])

#input

Type: string

The website URL to parse.

#options.glue

Type: string
Default: .

The delimiter for joining domain segments.

#options.name

Type: string
Default: www

The "name" of the domain product. Defaults to the subdomain (or "www") if found. Setting this will overwrite the value obtained from the input's subdomain.

#License

MIT © Luke Edwards

See also

clsx(3), @polka/cluster(3), @pwa/cli(3), uvu(3), taskr(3), sockette(3), klona(3), kleur(3), dequal(3), sirv-cli(3)