Per Pettersen Per Pettersen - 1 year ago 192
Javascript Question

Describing an array of objects in JsDoc

I've got a function which takes an array of objects.

Looks like this.

name: 'someName',
next: false,
test: 'test'
name: 'nameTwo',
next: true

So far my JSDOC looks like this

* My description
* @param {Array.<Object>}

But how can I describe the object properties, types and descriptions and if they are optional of the object?

Thank you.

Answer Source

JSDoc @param documentation

 * Assign the project to a list of employees.
 * @param {Object[]} employees - The employees who are responsible for the project.
 * @param {string} employees[].name - The name of an employee.
 * @param {string} employees[].department - The employee's department.
Project.prototype.assign = function(employees) {
    // ...
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download