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

npm-package-arg

Package Overview
Dependencies
Maintainers
6
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-package-arg

Parse the things that can be arguments to `npm install`

  • 12.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
6
Created

What is npm-package-arg?

The npm-package-arg package is a utility for parsing package names and specifiers in the npm ecosystem. It helps in understanding and manipulating package references, whether they are simple names, version ranges, GitHub URLs, or local paths.

What are npm-package-arg's main functionalities?

Parsing Package Names

This feature allows you to parse a simple package name. The output will be an object containing details about the package, such as its name, type, and registry.

const npa = require('npm-package-arg');
const parsed = npa('express');
console.log(parsed);

Parsing Version Ranges

This feature allows you to parse a package name with a version range. The output will include the specified version range and other details.

const npa = require('npm-package-arg');
const parsed = npa('express@^4.0.0');
console.log(parsed);

Parsing GitHub URLs

This feature allows you to parse a GitHub URL. The output will include details about the repository, such as the user and repo names.

const npa = require('npm-package-arg');
const parsed = npa('github:user/repo');
console.log(parsed);

Parsing Local Paths

This feature allows you to parse a local file path. The output will include details about the local path and the type of reference.

const npa = require('npm-package-arg');
const parsed = npa('file:./local-package');
console.log(parsed);

Other packages similar to npm-package-arg

FAQs

Package last updated on 26 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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