fix `undefined` when options has no description

When an option doesn't have a description `undefined` prefixes the (Supported by ...) declaration in the settings
This commit is contained in:
Tony Brix 2017-05-05 13:34:27 -05:00 committed by GitHub
parent 5da5b2be51
commit 3d490658e1
1 changed files with 2 additions and 2 deletions

View File

@ -133,9 +133,9 @@ buildOptionsForBeautifiers = function(beautifiers, allLanguages) {
return _.reduce(languageOptions, (function(result, optionDef, optionName) {
optionDef.beautifiers = _.uniq(optionDef.beautifiers)
if (optionDef.beautifiers.length > 0) {
optionDef.description = optionDef.description + " (Supported by " + (optionDef.beautifiers.join(', ')) + ")";
optionDef.description = (optionDef.description || "") + " (Supported by " + (optionDef.beautifiers.join(', ')) + ")";
} else {
optionDef.description = optionDef.description + " (Not supported by any beautifiers)";
optionDef.description = (optionDef.description || "") + " (Not supported by any beautifiers)";
}
if (result[optionName] != null) {
logger.warn("Duplicate option detected: ", optionName, optionDef);