{"action":"created","issue":{"url":"https://api.github.com/repos/jsdoc3/jsdoc/issues/904","labels_url":"https://api.github.com/repos/jsdoc3/jsdoc/issues/904/labels{/name}","comments_url":"https://api.github.com/repos/jsdoc3/jsdoc/issues/904/comments","events_url":"https://api.github.com/repos/jsdoc3/jsdoc/issues/904/events","html_url":"https://github.com/jsdoc3/jsdoc/issues/904","id":56578008,"number":904,"title":"`module.exports` does not always act like `exports`.","user":{"login":"mkantor","id":35091,"avatar_url":"https://avatars.githubusercontent.com/u/35091?v=3","gravatar_id":"","url":"https://api.github.com/users/mkantor","html_url":"https://github.com/mkantor","followers_url":"https://api.github.com/users/mkantor/followers","following_url":"https://api.github.com/users/mkantor/following{/other_user}","gists_url":"https://api.github.com/users/mkantor/gists{/gist_id}","starred_url":"https://api.github.com/users/mkantor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkantor/subscriptions","organizations_url":"https://api.github.com/users/mkantor/orgs","repos_url":"https://api.github.com/users/mkantor/repos","events_url":"https://api.github.com/users/mkantor/events{/privacy}","received_events_url":"https://api.github.com/users/mkantor/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-04T19:51:14Z","updated_at":"2015-02-05T16:46:41Z","closed_at":"2015-02-05T16:46:41Z","body":"Based on JSDoc's documentation (and common sense) I would expect things assigned to `module.exports` and `exports` to act the same, but this is not the case.\r\n\r\nThe following code produces the expected output, with `require(\"path/to/module\")` documented as a class which has a method named `foo()`.\r\n```javascript\r\n/**\r\n * Example of assigning a constructor to plain old exports and methods to\r\n * its prototype.\r\n * @module\r\n */\r\n\r\n/** @constructor */\r\nmodule.exports = exports = function() {};\r\n\r\n/** An instance method. */\r\nexports.prototype.foo = function() {};\r\n```\r\n\r\n---\r\n\r\nHowever, this version does *not* document the class, and `foo()` is nowhere to be seen in the generated docs.\r\n```javascript\r\n/**\r\n * Example of assigning a constructor to module.exports and methods to its\r\n * prototype.\r\n * @module\r\n */\r\n\r\n/** @constructor */\r\nmodule.exports = function() {};\r\n\r\n/** An instance method. */\r\nmodule.exports.prototype.foo = function() {};\r\n```"},"comment":{"url":"https://api.github.com/repos/jsdoc3/jsdoc/issues/comments/73080366","html_url":"https://github.com/jsdoc3/jsdoc/issues/904#issuecomment-73080366","issue_url":"https://api.github.com/repos/jsdoc3/jsdoc/issues/904","id":73080366,"user":{"login":"hegemonic","id":1522391,"avatar_url":"https://avatars.githubusercontent.com/u/1522391?v=3","gravatar_id":"","url":"https://api.github.com/users/hegemonic","html_url":"https://github.com/hegemonic","followers_url":"https://api.github.com/users/hegemonic/followers","following_url":"https://api.github.com/users/hegemonic/following{/other_user}","gists_url":"https://api.github.com/users/hegemonic/gists{/gist_id}","starred_url":"https://api.github.com/users/hegemonic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hegemonic/subscriptions","organizations_url":"https://api.github.com/users/hegemonic/orgs","repos_url":"https://api.github.com/users/hegemonic/repos","events_url":"https://api.github.com/users/hegemonic/events{/privacy}","received_events_url":"https://api.github.com/users/hegemonic/received_events","type":"User","site_admin":false},"created_at":"2015-02-05T16:46:41Z","updated_at":"2015-02-05T16:46:41Z","body":"The second example works just fine for me--the generated docs show the class and the `foo()` instance method. What version of JSDoc are you using?"}}