Socket
Socket
Sign inDemoInstall

@types/urijs

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/urijs

TypeScript definitions for urijs


Version published
Weekly downloads
1M
increased by3.63%
Maintainers
1
Weekly downloads
 
Created

What is @types/urijs?

@types/urijs provides TypeScript type definitions for the URI.js library, which is used for URL manipulation and parsing.

What are @types/urijs's main functionalities?

Parsing URLs

This feature allows you to parse a URL into its components such as protocol, hostname, port, path, query, and fragment.

const URI = require('urijs');
const uri = new URI('https://example.com:8080/path?query=1#fragment');
console.log(uri.protocol()); // 'https'
console.log(uri.hostname()); // 'example.com'
console.log(uri.port()); // '8080'
console.log(uri.path()); // '/path'
console.log(uri.query()); // 'query=1'
console.log(uri.fragment()); // 'fragment'

Building URLs

This feature allows you to build a URL by setting its components such as protocol, hostname, port, path, query, and fragment.

const URI = require('urijs');
const uri = new URI();
uri.protocol('https')
   .hostname('example.com')
   .port(8080)
   .path('/path')
   .query('query=1')
   .fragment('fragment');
console.log(uri.toString()); // 'https://example.com:8080/path?query=1#fragment'

Manipulating Query Parameters

This feature allows you to manipulate query parameters in a URL by adding or removing them.

const URI = require('urijs');
const uri = new URI('https://example.com/path?query=1');
uri.addQuery('newParam', 'newValue');
console.log(uri.toString()); // 'https://example.com/path?query=1&newParam=newValue'
uri.removeQuery('query');
console.log(uri.toString()); // 'https://example.com/path?newParam=newValue'

Other packages similar to @types/urijs

FAQs

Package last updated on 22 Nov 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