Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

get-package-type

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Issues
File Explorer

Advanced tools

get-package-type

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

    0.1.0latest

Version published
Maintainers
1
Weekly downloads
16,888,592
increased by2.02%

Weekly downloads

Changelog

Source

0.1.0 (2020-05-19)

Features

  • Initial implementation (52863f4)

Readme

Source

get-package-type NPM Version

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

Usage

const getPackageType = require('get-package-type'); (async () => { console.log(await getPackageType('file.js')); console.log(getPackageType.sync('file.js')); })();

This function does not validate the value found in package.json#type. Any truthy value found will be returned. Non-truthy values will be reported as commonjs.

The argument must be a filename.

// This never looks at `dir1/`, first attempts to load `./package.json`. const type1 = await getPackageType('dir1/'); // This attempts to load `dir1/package.json`. const type2 = await getPackageType('dir1/index.cjs');

The extension of the filename does not effect the result. The primary use case for this module is to determine if myapp.config.js should be loaded with require or import.

FAQs

What is get-package-type?

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

Is get-package-type popular?

The npm package get-package-type receives a total of 14,692,105 weekly downloads. As such, get-package-type popularity was classified as popular.

Is get-package-type well maintained?

We found that get-package-type demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 19 May 2020

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc