{"id":17419166,"url":"https://github.com/axtgr/denude","last_synced_at":"2025-09-03T10:33:58.067Z","repository":{"id":96592976,"uuid":"95018384","full_name":"axtgr/denude","owner":"axtgr","description":"👀 Expose the private parts of node modules","archived":false,"fork":false,"pushed_at":"2017-07-01T22:40:48.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-09T04:33:34.957Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/axtgr.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2017-06-21T15:24:23.000Z","updated_at":"2017-06-22T07:18:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"bcd8a5e8-fbff-4fa6-b1ad-e174577c33dc","html_url":"https://github.com/axtgr/denude","commit_stats":null,"previous_names":["alex-shnayder/denude"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/axtgr/denude","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axtgr%2Fdenude","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axtgr%2Fdenude/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axtgr%2Fdenude/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axtgr%2Fdenude/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/axtgr","download_url":"https://codeload.github.com/axtgr/denude/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axtgr%2Fdenude/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273430601,"owners_count":25104481,"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","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-17T02:17:13.125Z","updated_at":"2025-09-03T10:33:58.034Z","avatar_url":"https://github.com/axtgr.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# denude ![npm-version](https://img.shields.io/npm/v/denude.svg)\n\n*All that is hidden shall be revealed*\n\nAlthough testing private members is considered an antipattern, sometimes you really, *really* need to. Denude makes it easy to require functions and variables from the top scope of a module.\n\n\n## Usage\n\nModule you want to test:\n\n```js\nconst { format } = require('util')\n\n\nlet prefix = 'Hello, '\n\nfunction greet(name) {\n  return format(`${prefix}%s!`, name)\n}\n\nfunction helloWorld() {\n  return greet('World')\n}\n\nmodule.exports = { greet, helloWorld }\n```\n\nTest file:\n\n```js\nconst denude = require('denude')\nconst { helloWorld, greet: publicGreet } = denude('./module') // public parts\nconst { format, prefix, greet } = denude('./module?private') // private parts\n\nconsole.log(greet === publicGreet) // true\nconsole.log(helloWorld()) // Hello, World!\n```\n\nNotice that denude works independently from require. It means that `require('./module')` and `denude('./module')` will return different instances of all the members of the module:\n\n```js\nconst required = require('./module')\nconst publicDenude = denude('./module')\nconst privateDenude = denude('./module?private')\n\nconsole.log(required.greet === publicDenude.greet) // false\nconsole.log(privateDenude.greet === publicDenude.greet) // true\n```\n\n\n### Overriding require\n\nYou can use `require('denude/register')` to patch the native require globally. After that, any require that is passed a path with the `?private` prefix will return the private members instead of the exports.\n\nExample:\n\n```js\nrequire('denude/register')\n\nconst helloWorld = require('./module') // public parts\nconst { format, prefix, greet } = require('./module?private') // private parts\n```\n\nThis technique is useful with testing frameworks like [mocha](https://github.com/mochajs/mocha) and [ava](https://github.com/avajs/ava) that allow requiring modules on run:\n\n```shell\nmocha --require denude/register test\n```\n\n\n## License\n\n[ISC](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxtgr%2Fdenude","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxtgr%2Fdenude","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxtgr%2Fdenude/lists"}