Socket
Socket
Sign inDemoInstall

get-package-name

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    get-package-name

Get the name of a dependency from a module file path.


Version published
Weekly downloads
60K
increased by0.64%
Maintainers
1
Install size
4.15 kB
Created
Weekly downloads
 

Readme

Source

Get Package Name

GitHub license Build Status npm version

Extracts the name of a package from its file path.

const getPackageName = require('get-package-name')
getPackageName('./project/node_modules/@babel/parser/lib/index.js') // @babel/parser

Installation

This is a Node.js package available through the npm registry. Before installing, download and install Node.js. Node.js 12 or higher is required.

Installation is done using the npm install command:

$ npm install --save-dev get-package-name

API

getPackageName(modulePath, [moduleFolder])

Returns the package name for the given module file path.

modulePath

An absolute or relative path to a module.

moduleFolder

The name of the folder in which packages are installed. Defaults to "node_modules".

License

This package is MIT licensed.

FAQs

Last updated on 28 Sep 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc