diff --git a/lib/transform.js b/lib/transform.js index fbf73b2..39bc2a0 100644 --- a/lib/transform.js +++ b/lib/transform.js @@ -38,6 +38,7 @@ function transform (data) { doclet = renameThisProperty(doclet) doclet = removeMemberofFromModule(doclet) doclet = convertIsEnumFlagToKind(doclet) + doclet = renameModuleExports(doclet) return doclet }) @@ -401,3 +402,15 @@ function removeEnumChildren (json) { } }) } + +/** + * Default exports lose their module name, showing up as module.exports, which + * is not very friendly. This restores the module name if we have it. + */ +function renameModuleExports(doclet) { + if (doclet.name === 'module.exports' && doclet.longname.startsWith('module:')) { + doclet.name = doclet.longname.replace('module:','') + console.log(doclet) + } + return doclet +}