如何使用jsdoc格式化嵌套數組和對象?關於用jsDoc記錄嵌套數組和對象數據的問題
這是我最好的猜測:
an_obj = {
username1 : [
{
param1 : "value 1-1-1",
param2 : "value 1-1-2",
optional_nested : "1-1--2"
},
{
param1 : "value 1-2-1",
param2 : "value 1-2-2"
},
],
username2 : [
{
param1 : "value 2-1-1",
param2 : "value 2-1-2"
},
{
param1 : "value 2-2-1",
param2 : "value 2-2-2",
optional_nested : "2-2--2"
}
]
}
}
/**
* A function description.
* @param {Object} obj
* @param {Object} obj.username This is not the object name, but a name type.
* @param {Array} obj.username.array Desc... using [] would conflict with optional params.
* However this could be confused with an object called array.
* @param {String} obj.username.array.param1 Desc... This is the object name rather than a type.
* @param {String} obj.username.array.param2 Desc...
* @param {String} obj.username.array.[optional_param] Desc...
*/
var myFunc = function(obj){
//...
};
myFunc(an_obj);
我如何表明一個對象被一種字符串的索引?如何定義嵌套數組?
還不確定在可選參數中放置方括號的位置。
鏈接死了,上面的例子拋出「無效的類型表達式」與jsdoc 3.3 – 2015-01-23 10:14:33