Socket
Socket
Sign inDemoInstall

extract-domain

Package Overview
Dependencies
1
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.3.2 to 2.3.3

2

package.json
{
"name": "extract-domain",
"version": "2.3.2",
"version": "2.3.3",
"description": "Extract domain name from URL",

@@ -5,0 +5,0 @@ "source": "index.js",

@@ -1,3 +0,3 @@

Extract domain name from URL
==
# Extract domain name from URL
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4JDQMB6MRJXQE&source=url)

@@ -12,8 +12,7 @@ ![Travis](https://travis-ci.org/bjarneo/extract-domain.svg?branch=master)

Supports
--
## Supports
Browser and Node.
Usage
--
## Usage

@@ -24,4 +23,4 @@ ```bash

* urls = string|array
* returns string|array
- urls = string|array
- returns string|array

@@ -33,8 +32,9 @@ ```js

ES6
```js
import extractDomain from 'extract-domain';
import extractDomain from "extract-domain";
```
```js
const extractDomain = require('extract-domain');
const extractDomain = require("extract-domain");
```

@@ -44,19 +44,16 @@

const urls = [
'https://www.npmjs.com/package/extract-domain',
'http://www.example.com:80/path/to/myfile.html?key1=value1&key2=value2#SomewhereInTheDocument',
'http://user:password@example.com:80/path/to/myfile.html?key1=value1&key2=value2#SomewhereInTheDocument',
'https://npmjs.com/package/extract-domain',
'ftp://example.org/resource.txt',
'this.is.my@email.com'
"https://www.npmjs.com/package/extract-domain",
"http://www.example.com:80/path/to/myfile.html?key1=value1&key2=value2#SomewhereInTheDocument",
"http://user:password@example.com:80/path/to/myfile.html?key1=value1&key2=value2#SomewhereInTheDocument",
"https://npmjs.com/package/extract-domain",
"ftp://example.org/resource.txt",
"this.is.my@email.com"
];
extractDomain(urls[0]); // npmjs.com
extractDomain(urls); // [ 'npmjs.com', 'example.com', 'example.com', 'npmjs.com', 'example.org', 'email.com' ]
```
TLD support
--
## TLD support

@@ -66,3 +63,4 @@ TLD support require optional dependency to [`psl` library](https://www.npmjs.com/package/psl).

```js
const url = 'http://www.example.co.uk:80/path/to/myfile.html?key1=value1&key2=value2#SomewhereInTheDocument';
const url =
"http://www.example.co.uk:80/path/to/myfile.html?key1=value1&key2=value2#SomewhereInTheDocument";

@@ -72,3 +70,5 @@ extractDomain(url, { tld: true });

```
However, using the tld flag will slow down the process by many seconds. Benchmark:
```

@@ -81,4 +81,4 @@ # extract domain 10,000 times

Tests
--
## Tests
```bash

@@ -88,4 +88,4 @@ $ npm test

Coding style
--
## Coding style
```bash

@@ -95,4 +95,4 @@ $ npm run pretty

Benchmark
--
## Benchmark
```bash

@@ -102,14 +102,8 @@ $ npm run benchmark

Contribution
--
## Contribution
Contributions are appreciated.
License
--
## License
MIT-licensed. See LICENSE.
Donation
--
If this project has been helpful in any way, and you want to treat me a cup of coffee, please donate :)
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4JDQMB6MRJXQE&source=url)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc