Closed kosinaz closed 8 years ago
Almost perfect, but sadly there is still an issue with multiple default values.
Working version:
/**
* @param {[[Type]]} [a=1] [[Description]]
* @param {[[Type]]} [b=2] [[Description]]
* @param {[[Type]]} [c=3] [[Description]]
*/
var func = function (a, b, c) {
'use strict';
if (typeof a === 'undefined') a = 1;
if (typeof b === 'undefined') b = 2;
if (typeof c === 'undefined') {
c = 3;
}
};
Current result:
/**
*
*/
var func = function (a, b, c) {
'use strict';
if (typeof a === 'undefined') a = 1;
if (typeof b === 'undefined') {
b = 2;
}
if (typeof c === 'undefined') {
c = 3;
}
};
Expected result:
/**
* @param {[[Type]]} [a=1] [[Description]]
* @param {[[Type]]} [b=2] [[Description]]
* @param {[[Type]]} [c=3] [[Description]]
*/
var func = function (a, b, c) {
'use strict';
if (typeof a === 'undefined') a = 1;
if (typeof b === 'undefined') {
b = 2;
}
if (typeof c === 'undefined') {
c = 3;
}
};
Based on acknowledged style guides it is good practice to always follow a conditional or iteration statement with a block statement, even when said block would contain only a single statement. But doing so in the default value setting prevents the value to appear in the comments.
Working version:
Current result:
Expected result: