Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

which-module

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Issues
File Explorer

Advanced tools

which-module

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

    2.0.0latest

Version published
Maintainers
1
Weekly downloads
19,425,805
decreased by-12.07%

Weekly downloads

Changelog

Source

2.0.0 (2017-05-01)

Features

  • remove Node < 4 from official testing/support (#22) (ee7aff4)

BREAKING CHANGES

<a name="1.0.0"></a>

Readme

Source

which-module

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

Build Status Coverage Status Standard Version

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

Keywords

FAQs

What is which-module?

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

Is which-module popular?

The npm package which-module receives a total of 15,627,650 weekly downloads. As such, which-module popularity was classified as popular.

Is which-module well maintained?

We found that which-module demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 01 May 2017

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc