Socket
Socket
Sign inDemoInstall

parse-path

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-path - npm Package Compare versions

Comparing version 3.0.4 to 4.0.0

35

lib/index.js

@@ -55,3 +55,16 @@ "use strict";

output.protocol = output.protocol || output.protocols[0] || (isSsh(url) ? "ssh" : url.charAt(1) === "/" ? (url = url.substring(2)) && "" : "file");
var firstChar = url.charAt(1);
if (!output.protocol) {
output.protocol = output.protocols[0];
if (!output.protocol) {
if (isSsh(url)) {
output.protocol = "ssh";
} else if (firstChar === "/" || firstChar === "~") {
url = url.substring(2);
output.protocol = "file";
} else {
output.protocol = "file";
}
}
}

@@ -65,2 +78,4 @@ if (protocolIndex !== -1) {

output.resource = parts.shift();
} else {
output.resource = "";
}

@@ -79,6 +94,10 @@

output.resource = splits[0];
output.port = Number(splits[1]);
if (isNaN(output.port)) {
if (splits[1]) {
output.port = Number(splits[1]);
if (isNaN(output.port)) {
output.port = null;
parts.unshift(splits[1]);
}
} else {
output.port = null;
parts.unshift(splits[1]);
}

@@ -91,3 +110,7 @@ }

// Stringify the pathname
output.pathname = output.pathname || (output.protocol !== "file" || output.href[0] === "/" ? "/" : "") + parts.join("/");
if (output.protocol === "file") {
output.pathname = output.href;
} else {
output.pathname = output.pathname || (output.protocol !== "file" || output.href[0] === "/" ? "/" : "") + parts.join("/");
}

@@ -109,2 +132,4 @@ // #some-hash

output.query = qs.parse(output.search);
output.href = output.href.replace(/\/$/, "");
output.pathname = output.pathname.replace(/\/$/, "");
return output;

@@ -111,0 +136,0 @@ }

2

package.json
{
"name": "parse-path",
"version": "3.0.4",
"version": "4.0.0",
"description": "Parse paths (local paths, urls: ssh/git/etc)",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -118,3 +118,3 @@ <!-- Please do not edit this file. Edit the `blah` field in the `package.json` instead. If in doubt, open an issue. -->

I open-source almost everything I can, and I try to reply everyone needing help using these projects. Obviously,
I open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously,
this takes time. You can integrate and use these projects in your applications *for free*! You can even change the source code and redistribute (even resell it).

@@ -121,0 +121,0 @@

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