1
在像下面這樣的代碼上運行jsdoc時,@param文檔被忽略。我認爲這是因爲我在IIFE中返回函數,但考慮到JS在這種模式中有多普遍,我很難相信jsdoc無法處理它。jsdoc不信任@param聲明
/** @namespace */
var util = {
/**
* Repeat <tt>str</tt> several times.
* @param {google.maps.Marker} str The string to repeat.
* @param {number} [times=1] How many times to repeat the string.
* @returns {string}
*/
repeat: (function() {
var magicNumber = 1;
return function(str, times) {
if (times === undefined || times < magicNumber) {
times = magicNumber;
}
return new Array(times+1).join(str);
};
}())
};