An open API service indexing awesome lists of open source software.

https://github.com/strugee/node-domain-from-partial-url

Turn a URL, no matter how incomplete, into its domain name
https://github.com/strugee/node-domain-from-partial-url

domain hacktoberfest nodejs npm-module url

Last synced: about 2 months ago
JSON representation

Turn a URL, no matter how incomplete, into its domain name

Awesome Lists containing this project

README

          

# `domain-from-partial-url`

[![Build Status](https://travis-ci.org/strugee/node-domain-from-partial-url.svg?branch=master)](http://travis-ci.org/strugee/node-domain-from-partial-url)
[![Coverage Status](https://coveralls.io/repos/github/strugee/node-domain-from-partial-url/badge.svg?branch=master)](https://coveralls.io/github/strugee/node-domain-from-partial-url?branch=master)
[![npm](https://img.shields.io/npm/v/domain-from-partial-url.svg)](https://npmjs.com/package/domain-from-partial-url)
[![Greenkeeper badge](https://badges.greenkeeper.io/strugee/node-domain-from-partial-url.svg)](https://greenkeeper.io/)

Turn a URL, no matter how incomplete, into its domain name

## Installation

npm install domain-from-partial-url

## Usage

The module exports a single function which will take a vaguely URL-like thing and spit out a domain. For example:

```js
var domainFromPartialUrl = require('domain-from-partial-url');

domainFromPartialUrl('example.com'); // example.com
domainFromPartialUrl('http://example.com'); // example.com
domainFromPartialUrl('example.com/someinfo.html'); // example.com
domainFromPartialUrl('https://example.com/lots/of/stuff/index.html'); // example.com
```

## License

LGPL 3.0+

## Author

AJ Jordan