jsdoc2md / jsdoc-parse

parses jsdoc documentation from javascript or html files, outputs JSON
MIT License
99 stars 19 forks source link

Method assigned to a local variable and added to the exports object loses argument details #18

Closed whitlockjc closed 8 years ago

whitlockjc commented 8 years ago

Let's say I've got the following code:

/**
 * Finds JSON References defined within the provided array/object.
 *
 * @param {array|object} obj - The structure to find JSON References within
 * @param {module:JsonRefs~JsonRefsOptions} [options] - The JsonRefs options
 *
 * @returns {object} an object whose keys are JSON Pointers *(fragment version)* to where the JSON Reference is defined
 * and whose values are {@link module:JsonRefs~UnresolvedRefDetails}.
 *
 * @throws {Error} if `from` is not a valid JSON Pointer
 *
 * @alias module:JsonRefs.findRefs
 */
var findRefs = module.exports.findRefs = function (obj, options) {
  // ...
};

When looking at the static member details for JsonRefs.findRefs it looks like this: .findRefs ⇒ object There are no argument details in the member details. If I separate this into two parts the function argument details are included in the member details: .findRefs(obj, [options]) ⇒ object. Here is an example of the two-part version:

/**
 * Finds JSON References defined within the provided array/object.
 *
 * @param {array|object} obj - The structure to find JSON References within
 * @param {module:JsonRefs~JsonRefsOptions} [options] - The JsonRefs options
 *
 * @returns {object} an object whose keys are JSON Pointers *(fragment version)* to where the JSON Reference is defined
 * and whose values are {@link module:JsonRefs~UnresolvedRefDetails}.
 *
 * @throws {Error} if `from` is not a valid JSON Pointer
 *
 * @alias module:JsonRefs.findRefs
 */
function findRefs (obj, options) {
  // ...
}

module.exports.findRefs = findRefs;

Is this expected? I would think that both versions would generate the same member details.

75lb commented 8 years ago

hi.. I think you've stumbled across this jsdoc quirk.. it's a known issue..

jsdoc-parse tracks the underlying jsdoc very closely (via this fork) so as soon as they fix it i'll let you know here.

whitlockjc commented 8 years ago

Thanks.