Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

npm-package-arg

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-package-arg - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

10

npa.js

@@ -41,2 +41,3 @@ var url = require("url")

res.raw = arg
res.scope = null

@@ -46,4 +47,6 @@ // See if it's something like foo@...

debug("nameparse", nameparse)
if (nameparse && validName(nameparse[3])) {
if (nameparse && validName(nameparse[3]) &&
(!nameparse[2] || validName(nameparse[2]))) {
res.name = (nameparse[1] || "") + nameparse[3]
res.scope = nameparse[2] || null
arg = arg.substr(nameparse[0].length)

@@ -96,6 +99,9 @@ } else {

var p = arg.match(parseName)
if (p && validName(p[2])) {
if (p && validName(p[2]) &&
(!p[1] || validName(p[1]))) {
res.type = "range"
res.spec = "*"
res.rawSpec = ""
res.name = arg
res.scope = p[1] || null
} else {

@@ -102,0 +108,0 @@ parseLocal(res, arg)

2

package.json
{
"name": "npm-package-arg",
"version": "1.0.0",
"version": "1.1.0",
"description": "Parse the things that can be arguments to `npm install`",

@@ -5,0 +5,0 @@ "main": "npa.js",

var npa = require("../npa.js")
var path = require("path")

@@ -15,2 +16,37 @@ require("tap").test("basic", function (t) {

"@foo/bar": {
raw: "@foo/bar",
name: "@foo/bar",
scope: "foo",
rawSpec: "",
spec: "*",
type: "range"
},
"@foo/bar@": {
raw: "@foo/bar@",
name: "@foo/bar",
scope: "foo",
rawSpec: "",
spec: "*",
type: "range"
},
"@foo/bar@baz": {
raw: "@foo/bar@baz",
name: "@foo/bar",
scope: "foo",
rawSpec: "baz",
spec: "baz",
type: "tag"
},
"@f fo o al/ a d s ;f ": {
raw: "@f fo o al/ a d s ;f",
name: null,
rawSpec: "@f fo o al/ a d s ;f",
spec: path.resolve("@f fo o al/ a d s ;f"),
type: "local"
},
"foo@1.2.3": {

@@ -17,0 +53,0 @@ name: "foo",

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