Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
@types/urijs
Advanced tools
@types/urijs provides TypeScript type definitions for the URI.js library, which is used for URL manipulation and parsing.
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'
The query-string package is used for parsing and stringifying URL query strings. It is simpler and more focused on query string manipulation compared to URI.js, which offers a broader range of URL manipulation features.
The url-parse package provides similar functionality to URI.js for parsing and manipulating URLs. It is lightweight and focuses on URL parsing and construction, but may not offer as many features as URI.js.
The whatwg-url package is a full implementation of the WHATWG URL Standard. It provides comprehensive URL parsing and manipulation capabilities, similar to URI.js, but follows the WHATWG specifications closely.
npm install --save @types/urijs
This package contains type definitions for URI.js ( http://medialize.github.io/URI.js ).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/urijs
Additional Details
These definitions were written by RodneyJT https://github.com/RodneyJT, Brian Surowiec https://github.com/xt0rted, Pete Johanson https://github.com/petejohanson, Zhibin Liu https://github.com/ljqx, TeamworkGuy2 https://github.com/teamworkguy2.
FAQs
TypeScript definitions for urijs
The npm package @types/urijs receives a total of 427,895 weekly downloads. As such, @types/urijs popularity was classified as popular.
We found that @types/urijs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.