@ctrlpanel/strip-common-prefixes
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @ctrlpanel/strip-common-prefixes

Weekly Downloads

0

Version

1.0.0

License

UNLICENSED

Unpacked Size

1.52 kB

Total Files

5

Last publish

Collaborators

  • linusu