16

How do I document a function parameter that gets deconstructed in function arguments?

/**
 * Function deconstructs argument and do stuff.
 * @param {} *** what should i do here? ***
 */
function someFunction({ key1, key2, key3 }) {
    // do function stuffs
}
Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
Pulasthi Bandara
  • 526
  • 4
  • 16

1 Answers1

27

From the @param wiki page:

If a parameter is destructured without an explicit name, you can give the object an appropriate one and document its properties.

Documenting a destructuring parameter

/**
 * Assign the project to an employee.
 * @param {Object} employee - The employee who is responsible for the project.
 * @param {string} employee.name - The name of the employee.
 * @param {string} employee.department - The employee's department.
 */
Project.prototype.assign = function({ name, department }) {
    // ...
};
Zweih
  • 168
  • 10
Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143