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

url-toolkit

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

url-toolkit

Build an absolute URL from a base URL and a relative URL (RFC 1808). No dependencies!

  • 2.2.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
425K
increased by3.82%
Maintainers
1
Weekly downloads
 
Created

What is url-toolkit?

The url-toolkit npm package provides utilities for parsing, resolving, and normalizing URLs. It is particularly useful for handling URL manipulations in web applications, ensuring that URLs are correctly formatted and resolved.

What are url-toolkit's main functionalities?

Parsing URLs

This feature allows you to parse a URL into its components such as protocol, hostname, pathname, search, and hash. The code sample demonstrates how to parse a URL and log its components.

const URLToolkit = require('url-toolkit');
const parsedURL = URLToolkit.parseURL('https://example.com/path?query=123#hash');
console.log(parsedURL);

Resolving URLs

This feature allows you to resolve a relative URL against a base URL to get an absolute URL. The code sample shows how to resolve a relative URL to an absolute URL.

const URLToolkit = require('url-toolkit');
const resolvedURL = URLToolkit.buildAbsoluteURL('https://example.com/path/', '../newpath');
console.log(resolvedURL);

Normalizing URLs

This feature allows you to normalize a URL path, resolving any '..' or '.' segments. The code sample demonstrates how to normalize a URL path.

const URLToolkit = require('url-toolkit');
const normalizedURL = URLToolkit.normalizePath('https://example.com/path/../newpath');
console.log(normalizedURL);

Other packages similar to url-toolkit

Keywords

FAQs

Package last updated on 04 Feb 2022

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