Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@segment/top-domain

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@segment/top-domain

Finds the top domain for a URL

  • 3.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
24K
decreased by-60.79%
Maintainers
1
Weekly downloads
 
Created
Source

domain

CircleCI Codecov

Constructs possible levels from a url and attempts to set a cookie "." + domain for each, when it succeeds it returns the top level domain.

This only works on the domain itself, since it attempts to set a cookie.

Installation

$ npm install @segment/top-domain

API

var domain = require('top-domain');

assert('google.com' == domain('http://www.google.com'));
assert('google.co.uk' == domain('http://www.google.co.uk'));
assert('google.co.uk' == domain('http://google.co.uk'));
assert('github.com' == domain('http://gist.github.com/calvinfo/some_file'));
assert('' == domain('http://localhost:3000'));
assert('google.com' == domain('https://google.com:443/stuff'));
assert('' == domain('http://dev:3000'));
assert('' == domain('0.0.0.0'));
assert('' == domain('127.0.0.1'));

Keywords

FAQs

Package last updated on 19 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc