Wilt Wilt - 3 years ago 216
Javascript Question

jsDoc - how to specify array length

In

jsDoc
I can specify my array parameters and members like this:

/**
* @constructor
* @param {Array.<string>} myArray
*/
function someFunction( myArray ){

this.firstArray = myArray;

/** @member {Array.<float>} */
this.secondArray = [];

}


Is there also a way to specify the
length
, or
minLength
and
maxLength
of these arrays?

Answer Source

I think you're asking whether you can include the minimum/maximum length in the type expressions (for example, Array.<string>).

In short, the answer is no. You'll need to document the minimum/maximum length in the description of each array.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download