Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 27, 2024 via pnpm

npm-package-arg 4.2.1

Parse the things that can be arguments to `npm install`
Package summary
Share
0
issues
1
license
3
ISC
Package created
9 Jun 2014
Version published
7 Mar 2017
Maintainers
5
Total deps
3
Direct deps
2
License
ISC

Issues

0
This package has no issues

Licenses

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
3 Packages, Including:
hosted-git-info@2.8.9
npm-package-arg@4.2.1
semver@5.7.2
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

2
All Dependencies CSV
β“˜ This is a list of npm-package-arg 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
hosted-git-info2.8.97.92 kBISC
prod
semver5.7.217.45 kBISC
prod

Visualizations

Frequently Asked Questions

What does npm-package-arg do?

npm-package-arg is a Node.js package providing parsing capabilities for package names and their specifiers, commonly working in conjunction with commands like npm install or npm cache add. It efficiently deciphers arguments that could be passed to npm install. Besides, it is also capable of understanding the dependencies mentioned in package.json files.

How do you use npm-package-arg?

You can use npm-package-arg to parse package names and their versions, git repos, http URLs, and more. Here's a basic usage example:

var assert = require("assert")
var npa = require("npm-package-arg")

// Pass in the descriptor, and it'll return an object
try {
  var parsed = npa("@bar/foo@1.2")
} catch (ex) {
  // handle exception
}

The function npa(arg[, where]) parses an arg string that you might pass to npm install, returning a result object if the parsing is successful or throwing an error if not. The where optional argument specifies the path to resolve file paths relative to, and defaults to process.cwd().

Using npa.resolve(name, spec[, where]), you can resolve a module name and specifier to a npm install-friendly string, and have it relative to a specified where path.

The function npa.toPurl(arg, reg) can be used to get the package URL of a given package name/spec.

Example usage:

try {
  var resolved = npa.resolve('@foo/bar', '^1.0.0', './some/path')
} catch (ex) {
  // handle exception
}

Where are the npm-package-arg docs?

The official documents providing all the detailed information regarding npm-package-arg can be found in npm-package-arg's GitHub README hosted at https://github.com/npm/npm-package-arg. This README presents comprehensive information including examples of several possible arguments, describing how the package functions, how to use it, and explaining the structure of the output.