mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Fix undefined error when adding scoped package on yarn, npm or npx
This commit is contained in:
parent
b57cc11157
commit
9e1c90a914
7 changed files with 41 additions and 3 deletions
|
|
@ -86,7 +86,9 @@ function parsePackagename(arg) {
|
|||
const lastAtIndex = arg.lastIndexOf("@");
|
||||
|
||||
let name, version;
|
||||
if (lastAtIndex !== -1) {
|
||||
// The index of the last "@" should be greater than 0
|
||||
// If the index is 0, it means the package name starts with "@" (eg: "@vercel/otel")
|
||||
if (lastAtIndex > 0) {
|
||||
name = arg.slice(0, lastAtIndex);
|
||||
version = arg.slice(lastAtIndex + 1);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue