0.1.0 • Published 5 years ago

get-package-type v0.1.0

Weekly downloads
6,963,600
License
MIT
Repository
github
Last release
5 years ago

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.

@istanbuljs/load-nyc-confignyceasy-select-rnreact-native-bluetooth2react-native-template-rfbaseairscanairscan-examplereact-native-esc-pos-sahaab@borisovart/atol-kkt-moduledeneme323112@ntt_app/react-native-custom-notificationreact-native-covid-sdkgql_din_mod@olivervorasai/sliderreact-native-printer-brothersreact-native-shekhar-bridge-testwilscanner@oiti/documentoscopy-react-native@mink-opn/build-tokensquoc-test@infinitebrahmanuniverse/nolb-get-p@saaspe/componentsplginexpand-react-bridgeluminos-ui-coresklif-ui-kitsklif-api@everything-registry/sub-chunk-1752jawwy-sdkjawwy_gamification_releasereact-native-sphereuisphereuijawwy_libraryreact-native-credit-card-pkgp149-tablesklif-uireact-native-jawwy_samplegriffin-ui-librarynebula-http-resiliencycomposize@wacoco/ytapetailwind-vector-effectsyncbackbasestest-library-123test-haptik-libwontbreakvue-nycwoven-challenge-deploywifi_configuration_packagewskongkointeapackage-tatespoorman297superset-plugin-chart-hello-world2supercluster-googlemaps-adapter-clonesstanikionespotify-ds-sestp-cdktestapatesting-storybooktest-zeo-collectsvelte-component-libtext-based-game-enginevision-camera-plugin-face-detectorvision-camera-plugin-scan-facesvision-camera-base64-resizedv9u-smb2-singstorvantiq-reactvue-axios-rest@dormammuuuuu/json-helper@donapot/mylibtest@dotconf-pro/dotconf-pro@dotconf-pro/dotenv@digitalrakesh/jsui@dimcheify/dimui@dskdavid/flash_cli@cryptocode99/token-lists@cs6/react-native-test-native-view-library@cschanaj/nyc@con-test/react-native-concent-common@damruravihara/react-native-testing-package@cute-apocalypse/react-tree@corelmax/react-native-my2c2p-sdk@bytedance/babel-coverage-plugin@blueberry_muffins/email_library@blkmarketco/components-library@praella/localisationist@percent/percent-api-hooks@poscredit/plugin-chart-borisjulien-easy-modaljson-categorizejrennsoh88-react-native-scroll-indicatorjs-snippet-libraryjesh-calculationjnf-accesscontrol-rnttljordy-frijters-test-libiris-colorsk0ng_d1nosaur_quenak0ng_d1nosaur_quenbk0ng_d1nosaur_quenck0ng_d1nosaur_quend
0.1.0

5 years ago