npm-package-arg
Advanced tools
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) |
{ | ||
"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", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9230
252