Installations
npm install @zkochan/npm-package-arg
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=10.13
Node Version
12.19.0
NPM Version
6.14.11
Score
72.5
Supply Chain
93
Quality
75.5
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
Download Statistics
Total Downloads
854,406
Last Day
31
Last Week
898
Last Month
2,854
Last Year
97,751
GitHub Statistics
1 Stars
110 Commits
2 Watching
5 Branches
37 Contributors
Bundle Size
47.16 kB
Minified
14.13 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.0.1
Package Id
@zkochan/npm-package-arg@2.0.1
Size
5.12 kB
NPM Version
6.14.11
Node Version
12.19.0
Publised On
24 Mar 2021
Total Downloads
Cumulative downloads
Total Downloads
854,406
Last day
-36.7%
31
Compared to previous day
Last week
54.8%
898
Compared to previous week
Last month
-28.1%
2,854
Compared to previous month
Last year
-66.5%
97,751
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
3
@zkochan/npm-package-arg
Parses package name and specifier passed to commands like npm install
or
npm cache add
, or as found in package.json
dependency sections.
EXAMPLES
1var assert = require("assert") 2var npa = require("@zkochan/npm-package-arg") 3 4// Pass in the descriptor, and it'll return an object 5try { 6 var parsed = npa("@bar/foo@1.2") 7} catch (ex) { 8 … 9}
USING
var npa = require('@zkochan/npm-package-arg')
var result = npa(arg[, where])
- arg - a string that you might pass to
npm install
, like:foo@1.2
,@bar/foo@1.2
,foo@user/foo
,http://x.com/foo.tgz
,git+https://github.com/user/foo
,bitbucket:user/foo
,foo.tar.gz
,../foo/bar/
orbar
. If the arg you provide doesn't have a specifier part, egfoo
then the specifier will default tolatest
. - where - Optionally the path to resolve file paths relative to. Defaults to
process.cwd()
Throws if the package name is invalid, a dist-tag is invalid or a URL's protocol is not supported.
var result = npa.resolve(name, spec[, where])
- name - The name of the module you want to install. For example:
foo
or@bar/foo
. - spec - The specifier indicating where and how you can get this module. Something like:
1.2
,^1.7.17
,http://x.com/foo.tgz
,git+https://github.com/user/foo
,bitbucket:user/foo
,file:foo.tar.gz
orfile:../foo/bar/
. If not included then the default islatest
. - where - Optionally the path to resolve file paths relative to. Defaults to
process.cwd()
Throws if the package name is invalid, a dist-tag is invalid or a URL's protocol is not supported.
RESULT OBJECT
The objects that are returned by @zkochan/npm-package-arg contain the following keys:
type
- One of the following strings:git
- A git repotag
- A tagged version, like"foo@latest"
version
- A specific version number, like"foo@1.2.3"
range
- A version range, like"foo@2.x"
file
- A local.tar.gz
,.tar
or.tgz
file.directory
- A local directory.remote
- An http url (presumably to a tgz)
registry
- If true this specifier refers to a resource hosted on a registry. This is true fortag
,version
andrange
types.name
- If known, thename
field expected in the resulting pkg.scope
- If a name is something like@org/module
then thescope
field will be set to@org
. If it doesn't have a scoped name, then scope isnull
.escapedName
- A version ofname
escaped to match the npm scoped packages specification. Mostly used when making requests against a registry. Whenname
isnull
,escapedName
will also benull
.rawSpec
- The specifier part that was parsed out in calls tonpa(arg)
, or the value ofspec
in calls to `npa.resolve(name, spec).saveSpec
- The normalized specifier, for saving to package.json files.null
for registry dependencies.fetchSpec
- The version of the specifier to be used to fetch this resource.null
for shortcuts to hosted git dependencies as there isn't just one URL to try with them.gitRange
- If set, this is a semver specifier to match against git tags withgitCommittish
- If set, this is the specific committish to use with a git dependency.hosted
- Iffrom === 'hosted'
then this will be ahosted-git-info
object. This property is not included when serializing the object as JSON.raw
- The original un-modified string that was provided. If called asnpa.resolve(name, spec)
then this will bename + '@' + spec
.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: ISC License: LICENSE:0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
11 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
Score
1.7
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More