simpleurl

Removes protocol,top level domain, and hash fragment from urls.


Keywords
url, regex
License
MIT
Install
npm install simpleurl@1.0.2

Documentation

simpleurl

Removes protocol, www top level domain, trailing slash, and hash fragment.

Usage

var simpleurl = require('simpleurl');

console.log(simpleurl.getSimpleUrl("https://www.google.com/#hashfrag"));

Why?

How do you compare whether two urls are the same? Don't we view www.google.com as being the same as google.com? or https://google.com? This module removes these extras and creates a unique identifier from a url.

https://google.com https://google.com/ https://google.com/#hashfrag https://www.google.com/#hashfrag

will all be trimmed to:

google.com