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

get-package-type

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-package-type

Determine the `package.json#type` which applies to a location

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25M
increased by10.25%
Maintainers
1
Weekly downloads
 
Created

What is get-package-type?

The `get-package-type` npm package is designed to determine the type of a Node.js package. It can identify if a package is a CommonJS or an ECMAScript module by analyzing the package's configuration and structure. This is particularly useful in environments where understanding the module type is necessary for compatibility or transformation purposes.

What are get-package-type's main functionalities?

Determine package type

This feature allows you to determine whether a given package is a CommonJS or ECMAScript module. The function `getPackageType` takes the path to the package as an argument and returns a promise that resolves with the type of the package.

const getPackageType = require('get-package-type');

async function checkPackageType() {
  const type = await getPackageType('/path/to/package');
  console.log(`Package type: ${type}`); // 'commonjs' or 'module'
}

checkPackageType();

Other packages similar to get-package-type

FAQs

Package last updated on 19 May 2020

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