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

urijs

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

urijs

URI.js is a Javascript library for working with URLs.

  • 1.19.11
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.1M
decreased by-5.71%
Maintainers
1
Weekly downloads
 
Created

What is urijs?

The urijs (also known as URI.js) package is a versatile library for working with URLs. It provides utilities for parsing, manipulating, and building URIs in a fluent API style. This makes it easier to handle various components of URIs such as protocol, hostname, path, query, and fragment.

What are urijs's main functionalities?

Parsing URIs

This feature allows for parsing URIs and accessing their different components like protocol, hostname, etc. The example demonstrates how to parse a URI and retrieve the protocol component.

const URI = require('urijs');
const uri = URI('http://example.com/foo?bar=baz');
console.log(uri.protocol()); // 'http'

Manipulating URIs

This feature enables modification of various URI components. The example shows how to change the path segment of a URI.

const URI = require('urijs');
const uri = URI('http://example.com/foo');
const newUri = uri.segment('bar').toString();
console.log(newUri); // 'http://example.com/bar'

Building URIs

This feature is useful for constructing URIs from scratch by chaining methods to set different URI components. The example constructs a complete URI from individual components.

const URI = require('urijs');
const uri = URI().protocol('http').hostname('example.com').path('/foo').query({ bar: 'baz' }).toString();
console.log(uri); // 'http://example.com/foo?bar=baz'

Other packages similar to urijs

Keywords

FAQs

Package last updated on 03 Apr 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