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

ufo

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ufo

URL utils for humans

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.7M
decreased by-3.68%
Maintainers
1
Weekly downloads
 
Created

What is ufo?

The ufo npm package provides utilities for URL formatting and normalization. It helps in parsing, resolving, and normalizing URLs, as well as providing utilities for handling query parameters.

What are ufo's main functionalities?

Parsing and normalizing URLs

This feature allows you to normalize URLs, which includes removing the default port for HTTP and HTTPS, decoding unnecessary percent-encoded characters, and removing duplicate slashes.

const { normalizeURL } = require('ufo');
const normalizedUrl = normalizeURL('http://example.com:80/path/');

Handling query parameters

This feature enables you to easily add query parameters to a URL, which can be useful for constructing URLs with dynamic query strings.

const { withQuery } = require('ufo');
const urlWithQuery = withQuery('http://example.com', { query: 'value' });

Joining URLs

This feature is used to concatenate URL parts safely, ensuring that there are no duplicate slashes and that the query string is properly appended.

const { joinURL } = require('ufo');
const fullUrl = joinURL('http://example.com', '/path', '?query=value');

Other packages similar to ufo

FAQs

Package last updated on 29 Jul 2023

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