0.1.0 • Published 4 years ago

get-package-type v0.1.0

Weekly downloads
6,963,600
License
MIT
Repository
github
Last release
4 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_release@314oner_npm/universal-components-libraryreact-native-sphereuisphereuijawwy_libraryreact-native-credit-card-pkgp149-tablesklif-uireact-native-jawwy_sampleeditorjs_forkededitor.js-custom-multiple-selecteddskcorenew@object-studio/react-native-web@oiti/rn-liveness2dwarmaitech-gpt-3-encoder@podlubnaja/ui-kitoracle-zkapp@pengzhi1998/liboclif-core-rc@sameer-j/react-fetch-event-source@phong95/react-native-multiple-image-picker@samwinslow/edgedb@picaro/colorhelper@shonaui/core@shlomya/throttler@purnasatria/directus-extension-document-interface@siblo/nklgo@proton/core@sharshar/date-lib@sharshar/string-lib@sharshar/word-to-bin-lib@poscredit/plugin-chart-boris@praella/localisationistp147-tablep148-table@sephriot/react-native-persistable-uri@kylesferrazza/graphql-relay-updatednka-gantt-task-reactdate_operations_manipulatordate-to-block-ethvirtual-tour-guidenovacap-componentsnotion-database-exportervision-camera-base64-resizedvision-camera-plugin-face-detectorvision-camera-plugin-scan-facesnpm_qwertydemo-test-scrn@npm_fluentco/adflow-react-native-sdknpm-package-mentorcheckvue-axios-restdesign-system-fitbank-450@luciadias/storybook-notimation@nosnibor89/cdk-static-website-constructnpm_one_12_34_1_npm_one_1_2_3npm_one_2_2numhandlernumericaltstest-zeo-collectmicroend-componenttestapatesting-storybook@extrieve_technologies/quickcapture_react_nativetext-based-game-enginetest-library-123test-haptik-libmobtimer-api2teapackage-tatespoorman297@navabi/react-native-ssl-pinning
0.1.0

4 years ago