Skip to content

Strip common prefixes, that we don't need to display to the user, from hostnames

Notifications You must be signed in to change notification settings

ctrl-alt-deseat/ctrlpanel-strip-common-prefixes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Strip Common Prefixes

Strip common prefixes, that we don't need to display to the user, from hostnames.

Installation

npm install --save @ctrlpanel/strip-common-prefixes

Usage

const stripCommonPrefixes = require('@ctrlpanel/strip-common-prefixes')

console.log(stripCommonPrefixes('auth.example.com'))
//=> example.com

console.log(stripCommonPrefixes('www.example.com'))
//=> example.com

console.log(stripCommonPrefixes('hotels.example.com'))
//=> hotels.example.com

API

stripCommonPrefixes(hostname) => string

Returns the same hostname, but with common prefixes stripped.

About

Strip common prefixes, that we don't need to display to the user, from hostnames

Resources

Stars

Watchers

Forks

Packages

No packages published