Skip to content

How to document object params with particular properties #88

@askmike

Description

@askmike

I think I must be missing something here but I cannot figure out how to properly document object parameters (with specific properties). This is some documented code using jsdoc3:

/**
 * Transition the globe from its current position
 * to the new coordinates.
 *
 * @param  {Object} pos - the position
 * @param  {Float} pos.lat - latitude position
 * @param  {Float} pos.lon - longtitute position
 * @return  {this}
 */
api.center = function(pos) {
  target = calculate2dPosition(pos);
  return this;
}

Will output:

Globe.center(pos, pos.lat, pos.lon)

Transition the globe from its current position to the new coordinates.

Parameters
pos: Object, the position
pos.lat: Float, latitude position
pos.lon: Float, longtitute position
Returns: this

The first line is what I am not really happy about (this function only has a single parameter which is an object). After looking at the code it seems like something that is easily fixed by filtering the params before constructing the paramsString, but I am pretty sure that I am missing something obvious here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions