{"id":18280244,"url":"https://github.com/nexdrew/which-module","last_synced_at":"2025-04-09T12:05:13.800Z","repository":{"id":48660687,"uuid":"60501189","full_name":"nexdrew/which-module","owner":"nexdrew","description":":m: Find the module object for something that was require()d","archived":false,"fork":false,"pushed_at":"2023-04-21T14:38:21.000Z","size":39,"stargazers_count":27,"open_issues_count":8,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T06:17:00.454Z","etag":null,"topics":["import","lookup","module","nodejs","require","reverse"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nexdrew.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-06T05:39:02.000Z","updated_at":"2025-02-17T02:11:49.000Z","dependencies_parsed_at":"2024-06-18T14:08:39.556Z","dependency_job_id":null,"html_url":"https://github.com/nexdrew/which-module","commit_stats":{"total_commits":33,"total_committers":5,"mean_commits":6.6,"dds":0.5757575757575757,"last_synced_commit":"6fc19e87f358c7c5285d485c032c611e60ca7b2a"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nexdrew%2Fwhich-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nexdrew%2Fwhich-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nexdrew%2Fwhich-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nexdrew%2Fwhich-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nexdrew","download_url":"https://codeload.github.com/nexdrew/which-module/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036063,"owners_count":21037092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["import","lookup","module","nodejs","require","reverse"],"created_at":"2024-11-05T12:33:57.354Z","updated_at":"2025-04-09T12:05:13.767Z","avatar_url":"https://github.com/nexdrew.png","language":"JavaScript","readme":"# which-module\n\n\u003e Find the module object for something that was require()d\n\n[![Build Status](https://travis-ci.org/nexdrew/which-module.svg?branch=master)](https://travis-ci.org/nexdrew/which-module)\n[![Coverage Status](https://coveralls.io/repos/github/nexdrew/which-module/badge.svg?branch=master)](https://coveralls.io/github/nexdrew/which-module?branch=master)\n[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)\n[![Greenkeeper badge](https://badges.greenkeeper.io/nexdrew/which-module.svg)](https://greenkeeper.io/)\n\nFind the `module` object in `require.cache` for something that was `require()`d\nor `import`ed - essentially a reverse `require()` lookup.\n\nUseful for libs that want to e.g. lookup a filename for a module or submodule\nthat it did not `require()` itself.\n\n## Install and Usage\n\n```\nnpm install --save which-module\n```\n\n```js\nconst whichModule = require('which-module')\n\nconsole.log(whichModule(require('something')))\n// Module {\n//   id: '/path/to/project/node_modules/something/index.js',\n//   exports: [Function],\n//   parent: ...,\n//   filename: '/path/to/project/node_modules/something/index.js',\n//   loaded: true,\n//   children: [],\n//   paths: [ '/path/to/project/node_modules/something/node_modules',\n//            '/path/to/project/node_modules',\n//            '/path/to/node_modules',\n//            '/path/node_modules',\n//            '/node_modules' ] }\n```\n\n## API\n\n### `whichModule(exported)`\n\nReturn the [`module` object](https://nodejs.org/api/modules.html#modules_the_module_object),\nif any, that represents the given argument in the `require.cache`.\n\n`exported` can be anything that was previously `require()`d or `import`ed as a\nmodule, submodule, or dependency - which means `exported` is identical to the\n`module.exports` returned by this method.\n\nIf `exported` did not come from the `exports` of a `module` in `require.cache`,\nthen this method returns `null`.\n\n## License\n\nISC © Contributors\n\n[opensourceregistry_package_id]: # (458260416784685e5ef3091fee54001785dd4360406aa3000315ff256eef6878)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnexdrew%2Fwhich-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnexdrew%2Fwhich-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnexdrew%2Fwhich-module/lists"}