Socket
Book a DemoInstallSign in
Socket

@eternaljs/url-parser

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eternaljs/url-parser

This basic package allows you to parse a URL into its singular parts, i.e protocol, username, password, hostname, port, domain, subdomain.

1.1.3
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

URL Parser

A URL (Uniform Resource Locator) is a unique identifier used to locate a resource on the Internet. It is also referred to as a web address. URLs consist of multiple parts -- including a protocol and domain name -- that tell a web browser how and where to retrieve a resource.

This basic tool allows you to parse a URL into its singular parts, i.e protocol, username, password, hostname, port, domain, subdomain.

Installing

Using npm:

$ npm install @eternaljs/url-parser

Using yarn:

$ yarn add @eternaljs/url-parser

Usage

These examples assume you're in node, or something similar:

// JavaScript
const { getUrlInfo } = require('@eternaljs/url-parser');

// TypeScript
import { getUrlInfo } from '@eternaljs/url-parser';


const details = getUrlInfo('https://console.cloud.google.com/welcome?project=eternaljs');
console.log(details);

Output

The output will be URL full details like Protocol, Hostname, Subdomain:

{
  href: 'https://console.cloud.google.com/welcome?project=eternaljs',
  protocol: 'https:',
  hostname: 'console.cloud.google.com',
  port: '',
  pathname: '/welcome',
  param: [ 'welcome' ],
  query: { project: 'eternaljs' },
  search: '?project=eternaljs',
  hash: '',
  sub_domain: 'console'
}

License

MIT

Keywords

domain

FAQs

Package last updated on 19 Mar 2024

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.