npm-package-arg
Advanced tools
Comparing version 5.1.2 to 6.0.0
15
npa.js
@@ -21,2 +21,11 @@ 'use strict' | ||
let spec | ||
if (typeof arg === 'object') { | ||
if (arg instanceof Result && (!where || where === arg.where)) { | ||
return arg | ||
} else if (arg.name && arg.rawSpec) { | ||
return npa.resolve(arg.name, arg.rawSpec, where || arg.where) | ||
} else { | ||
return npa(arg.raw, where || arg.where) | ||
} | ||
} | ||
const nameEndsAt = arg[0] === '@' ? arg.slice(1).indexOf('@') + 1 : arg.indexOf('@') | ||
@@ -135,6 +144,4 @@ const namePart = nameEndsAt > 0 ? arg.slice(0, nameEndsAt) : arg | ||
res.gitCommittish = null | ||
} else if (committish == null || committish === '') { | ||
res.gitCommittish = 'master' | ||
} else { | ||
res.gitCommittish = committish | ||
res.gitCommittish = committish === '' ? null : committish | ||
} | ||
@@ -209,3 +216,3 @@ return res | ||
fetchSpec: matched[1], | ||
gitCommittish: matched[2] || 'master' | ||
gitCommittish: matched[2] == null ? null : matched[2] | ||
} | ||
@@ -212,0 +219,0 @@ } |
{ | ||
"name": "npm-package-arg", | ||
"version": "5.1.2", | ||
"version": "6.0.0", | ||
"description": "Parse the things that can be arguments to `npm install`", | ||
@@ -13,5 +13,5 @@ "main": "npa.js", | ||
"dependencies": { | ||
"hosted-git-info": "^2.4.2", | ||
"hosted-git-info": "^2.5.0", | ||
"osenv": "^0.1.4", | ||
"semver": "^5.1.0", | ||
"semver": "^5.4.1", | ||
"validate-npm-package-name": "^3.0.0" | ||
@@ -18,0 +18,0 @@ }, |
# npm-package-arg | ||
[![Build Status](https://travis-ci.org/npm/npm-package-arg.svg?branch=master)](https://travis-ci.org/npm/npm-package-arg) | ||
Parses package name and specifier passed to commands like `npm install` or | ||
@@ -4,0 +6,0 @@ `npm cache add`, or as found in `package.json` dependency sections. |
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
13648
252
84
Updatedhosted-git-info@^2.5.0
Updatedsemver@^5.4.1