Socket
Socket
Sign inDemoInstall

@pnpm/pkgid-to-filename

Package Overview
Dependencies
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnpm/pkgid-to-filename - npm Package Compare versions

Comparing version 3.0.0-1 to 3.0.0-2

0

lib/index.d.ts
export default function pkgIdToFilename(pkgId: string, prefix: string): string;

6

lib/index.js

@@ -6,4 +6,6 @@ "use strict";

function pkgIdToFilename(pkgId, prefix) {
if (pkgId.indexOf('file:') !== 0)
return pkgId;
if (pkgId.indexOf('file:') !== 0) {
const index = pkgId.lastIndexOf('/');
return `${pkgId.substr(0, index)}@${pkgId.substr(index + 1)}`;
}
const absolutePath = normalize(path.join(prefix, pkgId.slice(5)));

@@ -10,0 +12,0 @@ const lastSlash = absolutePath.lastIndexOf('/');

{
"name": "@pnpm/pkgid-to-filename",
"version": "3.0.0-1",
"version": "3.0.0-2",
"description": "Converts a package ID to a valid file name",

@@ -8,3 +8,4 @@ "main": "lib/index.js",

"files": [
"lib"
"lib",
"!*.map"
],

@@ -11,0 +12,0 @@ "engines": {

@@ -9,4 +9,2 @@ # @pnpm/pkgid-to-filename

Most package IDs are already unique and valid filenames, so only the package IDs of local dependencies are converted.
## Installation

@@ -32,3 +30,3 @@

pkgIdToFilename('registry.npmjs.org/foo/1.0.0')
//> registry.npmjs.org/foo/1.0.0
//> registry.npmjs.org/foo@1.0.0
```

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