Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

bare-url

Package Overview
Dependencies
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bare-url - npm Package Compare versions

Comparing version
2.2.2
to
2.3.0
+59
-0
index.js

@@ -392,1 +392,60 @@ const path = require('bare-path')

}
exports.format = function format(parts) {
const {
protocol,
auth,
host,
hostname,
port,
pathname,
search,
query,
hash,
slashes
} = parts
let result = ''
if (typeof protocol === 'string') {
result += protocol
if (protocol[protocol.length - 1] !== ':') {
result += ':'
}
if (slashes === true || /https?|ftp|gopher|file/.test(protocol)) {
result += '//'
}
}
if (typeof auth === 'string') {
if (host || hostname) result += auth + '@'
}
if (typeof host === 'string') result += host
else {
result += hostname
if (port) result += ':' + port
}
if (typeof pathname === 'string' && pathname !== '') {
if (pathname[0] !== '/') result += '/'
result += pathname
}
if (typeof search === 'string') {
if (search[0] !== '?') result += '?'
result += search
} else if (typeof query === 'object' && query !== null) {
result += '?' + new URLSearchParams(query)
}
if (typeof hash === 'string') {
if (hash[0] !== '#') result += '#'
result += hash
}
return result
}
+1
-1
{
"name": "bare-url",
"version": "2.2.2",
"version": "2.3.0",
"description": "WHATWG URL implementation for JavaScript",

@@ -5,0 +5,0 @@ "exports": {