1.3.0 • Published 3 years ago

untld v1.3.0

Weekly downloads
54
License
MIT
Repository
github
Last release
3 years ago

Untld 👾

The zero-dependency ~400B TLD manager for your Javascript projects.

Install

npm install --save untld

Usage

// Ex. domain: https://github.com/mjanssen

import untld from 'untld';

// Get information about the current domain
untld();

{
  protocol: 'https://',
  domain: 'github',
  tld: 'com',
  path: '/mjanssen',
  query: {},
}

// Get information about any other domain
untld({
  domain: 'https://some.domain.co.uk/this-is-the/path?q=something-here',
});

{
  protocol: 'https://',
  domain: 'some.domain',
  tld: 'co.uk',
  path: '/this-is-the/path',
  query: { q: 'something-here' },
}

// If you have to support other special double tlds
untld({
  domain: 'https://some.other.domain.in.ua/this-is-the/path',
  customTlds: ['in.ua'],
});

{
  protocol: 'https://',
  domain: 'some.other.domain',
  tld: 'in.ua',
  path: '/this-is-the/path',
  query: {},
}

Demo

Code demo can be found here

License

MIT

1.3.0

3 years ago

1.2.0

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.1.0

5 years ago

1.0.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago