subdomain-collapse

v0.1.0
string.replace. collapses www., www1., etc subdomains from pathnames. for standardization, if /www[0-9]?/ and bare domains exist together and need to be treated as the same.
boilerplate starter quickstart template

subdomain-collapse

collapses www., www1., etc subdomains from pathnames. for standardization, if /www[0-9]?/ and bare domains exist together and need to be treated as the same.

Build Status
NPM

testling badge

install

npm install subdomain-collapse

test

npm test

usage

var sc = require('subdomain-collapse');

var result = sc('www.my-domain.org');
console.log(result);
// my-domain.org

var result2 = sc('www1.my-domain.org');
console.log(result2);
// my-domain.org

var result2 = sc('mail.my-domain.org');
console.log(result2);
// mail.my-domain.org
npm i subdomain-collapse

Metadata

  • MIT
  • Whatever
  • Tom Hummel
  • released 3/18/2014

Downloads

Maintainers