Find the module object for something that was require()d
npm install which-module> Find the module object for something that was require()d




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.
```
npm install --save which-module
`js
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' ] }
`
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 aexported
module, submodule, or dependency - which means is identical to themodule.exports returned by this method.
If exported did not come from the exports of a module in require.cache,null`.
then this method returns
ISC © Contributors
[opensourceregistry_package_id]: # (458260416784685e5ef3091fee54001785dd4360406aa3000315ff256eef6878)