File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,23 @@ Project.prototype.assign = function(employee) {
107107```
108108{% endexample %}
109109
110+ If a parameter is destructured without an explicit name, you can give the object an appropriate one and
111+ document its properties.
112+
113+ {% example "Documenting a destructuring parameter" %}
114+ ``` js
115+ /**
116+ * Assign the project to an employee.
117+ * @param {Object} employee - The employee who is responsible for the project.
118+ * @param {string} employee.name - The name of the employee.
119+ * @param {string} employee.department - The employee's department.
120+ */
121+ Project .prototype .assign = function ({ name, department }) {
122+ // ...
123+ };
124+ ```
125+ {% endexample %}
126+
110127You can also combine this syntax with JSDoc's syntax for array parameters. For example, if multiple
111128employees can be assigned to a project:
112129
Original file line number Diff line number Diff line change @@ -127,8 +127,19 @@ <h3 id="parameters-with-properties">Parameters with properties</h3>
127127Project.prototype.assign = function(employee) {
128128 // ...
129129};
130- </ code > </ pre >
131- </ figure >
130+ </ code > </ pre > </ figure >
131+ < p > If a parameter is destructured without an explicit name, you can give the object an appropriate one and document its properties.</ p >
132+ < figure >
133+ < figcaption > Documenting a destructuring parameter</ figcaption > < pre class ="prettyprint lang-js "> < code > /**
134+ * Assign the project to an employee.
135+ * @param {Object} employee - The employee who is responsible for the project.
136+ * @param {string} employee.name - The name of the employee.
137+ * @param {string} employee.department - The employee's department.
138+ */
139+ Project.prototype.assign = function({ name, department }) {
140+ // ...
141+ };
142+ </ code > </ pre > </ figure >
132143 < p > You can also combine this syntax with JSDoc's syntax for array parameters. For example, if multiple employees can be assigned to a project:</ p >
133144 < figure >
134145 < figcaption > Documenting properties of values in an array</ figcaption > < pre class ="prettyprint lang-js "> < code > /**
You can’t perform that action at this time.
0 commit comments