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

component-url

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

component-url

url parser.

  • 0.2.0
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

url

url parser.

Installation

$ component install component/url

Example

var url = require('url');
url.parse('http://example.com:3000/store/shoes?sort=desc');

yields:

{
  hash: ""
  host: "example.com:3000"
  port: 3000,
  hostname: "example.com"
  href: "http://example.com:3000/store/shoes?sort=desc"
  pathname: "/store/shoes"
  protocol: "http:"
  query: "sort=desc"
  search: "?sort=desc"
}

API

url.parse(string)

Parse the given url string.

url.isAbsolute(string)

Check if the given url string is absolute (has a scheme specified).

url.isRelative(string)

Check if the given url string is relative.

url.isCrossDomain(string)

Check if the given url string is cross-domain.

Note

This url "parser" uses an <a> tag, this means that when a relative url is given, such as "/foo", it becomes relative to the current domain / path, because the browser resolves it as it normally would.

License

MIT

FAQs

Package last updated on 18 Jun 2015

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