New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@jsenv/urls

Package Overview
Dependencies
Maintainers
0
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsenv/urls - npm Package Compare versions

Comparing version 2.5.2 to 2.5.3

5

package.json
{
"name": "@jsenv/urls",
"version": "2.5.2",
"version": "2.5.3",
"license": "MIT",

@@ -28,5 +28,2 @@ "repository": {

"sideEffects": false,
"scripts": {
"test": "node --conditions=development ./scripts/test.mjs"
},
"dependencies": {

@@ -33,0 +30,0 @@ "@jsenv/humanize": "1.2.8"

1

src/url_to_basename.js

@@ -10,3 +10,2 @@ import { urlToFilename } from "./url_to_filename.js";

let currentBasename = basename;
// eslint-disable-next-line no-constant-condition
while (true) {

@@ -13,0 +12,0 @@ const nextBasename = filenameToBasename(basename);

import { fileURLToPath } from "node:url";
export const urlToFileSystemPath = (url) => {
let urlString = String(url);
if (urlString[urlString.length - 1] === "/") {
const urlObject = new URL(url);
let urlString;
if (urlObject.hash) {
const origin =
urlObject.protocol === "file:" ? "file://" : urlObject.origin;
urlString = `${origin}${urlObject.pathname}${urlObject.search}%23${urlObject.hash.slice(1)}`;
} else {
urlString = urlObject.href;
}
const fileSystemPath = fileURLToPath(urlString);
if (fileSystemPath[fileSystemPath.length - 1] === "/") {
// remove trailing / so that nodejs path becomes predictable otherwise it logs
// the trailing slash on linux but does not on windows
urlString = urlString.slice(0, -1);
return fileSystemPath.slice(0, -1);
}
const fileSystemPath = fileURLToPath(urlString);
return fileSystemPath;
};

@@ -21,3 +21,3 @@ import { filenameToBasename } from "./url_to_basename.js";

return true;
} catch (e) {
} catch {
return false;

@@ -24,0 +24,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