Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 2, 2024 via pnpm

url-parse 1.5.10

Small footprint URL parser that works seamlessly across Node.js and browser environments
Package summary
Share
0
issues
1
license
3
MIT
Package created
8 Oct 2014
Version published
22 Feb 2022
Maintainers
4
Total deps
3
Direct deps
2
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
3 Packages, Including:
querystringify@2.2.0
requires-port@1.0.0
url-parse@1.5.10
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

2
All Dependencies CSV
β“˜ This is a list of url-parse 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
querystringify2.2.03.03 kBMIT
prod
requires-port1.0.02.99 kBMIT
prod

Visualizations

Frequently Asked Questions

What does url-parse do?

"url-parse" is a lightweight JavaScript library that provides efficient and versatile URL parsing across Node.js and browser environments. This utility was initially designed when the WHATWG URL API was not supported in Node.js, and the URL interface was available only in certain browsers. Now, though, this package offers two different API interfaces: the familiar URL interface from Node.js, and the newer URL interface available in the latest browsers. As well as parsing URLs, url-parse also makes the packaged "querystringify" module available. This tool, with its small footprint, is particularly suited to client-side use, offering a reliable URL parsing solution for different JavaScript environments such as the Worker interface.

How do you use url-parse?

To use url-parse in your application, you first need to install it using npm with the command npm install url-parse. Once installed, you can import it in your Node.js file using require:

var Url = require('url-parse');

You can then parse a URL by creating a new instance of the Url object and passing the URL string as an argument. This can be an absolute or relative URL.

var url = new Url('https://github.com/foo/bar');

If necessary, you can also specify a base URL and a query string parser.

In addition to the above method, url-parse also supports the Node.js interface, so you can use the library in this way:

var parse = require('url-parse'),
    url = parse('https://github.com/foo/bar', true);

The parsed URL instance will contain several properties such as protocol, hostname, port, pathname, and query.

To modify parts of the URL and propagate the changes through all properties, you can use the set method:

var parsed = parse('http://google.com/parse-things');

parsed.set('hostname', 'yahoo.com');
console.log(parsed.href); // outputs: http://yahoo.com/parse-things

Finally, to generate a full URL from the parsed object, you can use the toString method:

var location = url.toString(); // outputs: http://example.com/whatever/?qs=32

Where are the url-parse docs?

The complete documentation for url-parse is available on the package's GitHub page, which you can visit at: https://github.com/unshiftio/url-parse. Here, you will find detailed information on installation, usage, testing, and licensing, in addition to the full readme content. The npm registry entry for the package also includes links to the GitHub repository and other relevant resources.