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_modbitget@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_packagewskongkoinrn-tm-notifyrn-use-modal-hookrn-currency-formatterrn-counter-demorn-session-multiplier-demorn_unique_device_idrnttlockshainareqioxresponsis-gantt-task-reactreactnativelyreactofy-css-libraryreikamoon-string-library-aarfp-librn-check-btnrn-adyen-dropinteapackage-tatespoorman297superset-plugin-chart-hello-world2supercluster-googlemaps-adapter-clonesstanikionespotify-ds-sestp-cdksequelcomponentrouter-loggerreact-native-wtfreact-native-version-appreact-native-withframework-checkserde_json_maintestapatesting-storybooktest-zeo-collectsvelte-component-libtext-based-game-enginevision-camera-plugin-face-detectorvision-camera-plugin-scan-facesvision-camera-base64-resizedv9u-smb2-singstorvantiq-reactvue-axios-rest@atlantjs.dev/guardian@simstudio/htmldiffjawwy_library_newjawy_library_v1gamification-jawwy-libraryframework_test_library_sixdee_new_jawwytest_lib_module_aardfeuk-frontenddfeuk-frontend-manual
0.1.0

5 years ago