2.0.1 • Published 1 year ago

which-module v2.0.1

Weekly downloads
20,188,689
License
ISC
Repository
github
Last release
1 year ago

which-module

Find the module object for something that was require()d

Build Status Coverage Status Standard Version Greenkeeper badge

Find the module object in require.cache for something that was require()d or imported - essentially a reverse require() lookup.

Useful for libs that want to e.g. lookup a filename for a module or submodule that it did not require() itself.

Install and Usage

npm install --save which-module
const whichModule = require('which-module')

console.log(whichModule(require('something')))
// Module {
//   id: '/path/to/project/node_modules/something/index.js',
//   exports: [Function],
//   parent: ...,
//   filename: '/path/to/project/node_modules/something/index.js',
//   loaded: true,
//   children: [],
//   paths: [ '/path/to/project/node_modules/something/node_modules',
//            '/path/to/project/node_modules',
//            '/path/to/node_modules',
//            '/path/node_modules',
//            '/node_modules' ] }

API

whichModule(exported)

Return the module object, if any, that represents the given argument in the require.cache.

exported can be anything that was previously require()d or imported as a module, submodule, or dependency - which means exported is identical to the module.exports returned by this method.

If exported did not come from the exports of a module in require.cache, then this method returns null.

License

ISC © Contributors

archetype-libraryeasy-select-rnvuedragdropuploadimagesreact-native-bluetooth2killi8n-react-native-fast-imagern-send-smsspecify-importsbabel-specify-imports@icanpm/api-masterfoshata-markdown@cashremit/cr-streamline-iconsreact-native-template-rfbaseairscanairscan-examplebb-chatreact-native-esc-pos-sahaab@borisovart/atol-kkt-module@frxf/frxfdeneme323112@texttree/demo-bsa-reference-rcl@ntt_app/react-native-custom-notificationreact-native-custom-text-hwjamesreact-native-covid-sdkgql_din_modbitgetreact-native-thanh-toast-librarysalut_gongjang_first_module@jttechnic/interpreter@thanhnguyen14797/react-native-thanh-toast-library@l1nyanm1ng/react-picture-viewercthpb-plugin-social@olivervorasai/sliderreact-native-printer-brothersrn-pdf-reader-offlinereact-native-shekhar-bridge-testwilscanner@oiti/documentoscopy-react-native@mink-opn/build-tokensquoc-testreact-native-slider-kfnodejs-fileshareunblock-block-save-variables@infinitebrahmanuniverse/nolb-whi@prodam/prodam-typesplginexpand-react-bridgeluminos-ui-corejawwy-sdkjawwy_gamification_release@everything-registry/sub-chunk-3144react-native-sphereuisphereuijawwy_libraryreact-native-credit-card-pkgreact-native-jawwy_sample@ifanshx/cycgods@igniswap/igni-swap-lib@idas1/ui-component-lib@innoswap/core@innoswap/default-token-list@inovando-boletos/boleto@innodata/vue-v3-ya-metrika@icetee/react-recaptcha-v3@hawkingnetwork/react-native-tab-view@gzup/react-image-file-resizer@iyansr/react-native-image-viewing@jarrydark/editorsimplejs@inti-ar/evm-chains@levlevin/react-portal-tooltip@materia-dex/materia-contracts-proxy@maujzs/branch-release@massivepixel/use-query@linewit/vue-router-generator@jretts/modified-sveltejs@meysam213/react-leaflet@neuraiproject/chains@namtoonix/editorjs-custom-multiple-selected@ngxvoice/ngx-voicelistner@nirin100/quadratic-protocol@nirin100/quadratic-sdk@khainh/mongoose-delete@lanz1/v-money3@kylesferrazza/graphql-relay-updated@lehuyaa/my-assets@geeky-apo/react-native-advanced-clipboard@glyw/react-native-tabbed-section-list@golocalinteractive/storage-essentials-components@lofcz/sweetalert2-neutral@luaeb/assets@litedexdev/litedex-core-swap@litedexdev/litedexdev-default-token-list@meerasolution/react-native-ms-upi-payment@meklitc7/date-library@meklitc7/string-library@metabitswap/default-token-list@maricode1111/date-lib@hbglobal/react-native-actions-shortcuts@hazyflame/vue-jitsi-meet@headgum/tko-mapping@hemith/react-native-tnk
2.0.1-rc1

1 year ago

2.0.1

1 year ago

2.0.0

7 years ago

1.0.0

8 years ago