reverse-dns
v1.0.0
Published
Get the reverse domain name notation (or 'reverse DNS') for a site.
Downloads
15
Maintainers
Readme
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