diff --git a/apps/generator/lib/generator.js b/apps/generator/lib/generator.js index 8b2592a6f..077634e1c 100644 --- a/apps/generator/lib/generator.js +++ b/apps/generator/lib/generator.js @@ -875,7 +875,7 @@ class Generator { const shouldOverwriteFile = await this.shouldOverwriteFile(relativeTargetFile); if (!shouldOverwriteFile) return; - if (this.templateConfig.conditionalFiles && this.templateConfig.conditionalFiles[relativeSourceFile]) { + if (this.templateConfig.conditionalFiles?.[relativeSourceFile]) { const server = this.templateParams.server && asyncapiDocument.servers().get(this.templateParams.server); const source = jmespath.search({ ...asyncapiDocument.json(), diff --git a/apps/generator/lib/utils.js b/apps/generator/lib/utils.js index 6403eb2fd..e43d09363 100644 --- a/apps/generator/lib/utils.js +++ b/apps/generator/lib/utils.js @@ -131,7 +131,7 @@ utils.getGeneratorVersion = () => { * @returns {Boolean} is function asynchronous */ utils.isAsyncFunction = (fn) => { - return fn && fn.constructor && fn.constructor.name === 'AsyncFunction'; + return fn?.constructor?.name === 'AsyncFunction'; }; /** diff --git a/apps/nunjucks-filters/src/customFilters.js b/apps/nunjucks-filters/src/customFilters.js index 83ef06fbb..0914c821a 100644 --- a/apps/nunjucks-filters/src/customFilters.js +++ b/apps/nunjucks-filters/src/customFilters.js @@ -150,9 +150,11 @@ function docline(field, fieldName, scopePropName) { const getPName = (pName) => pName ? `${pName}.` : ''; const buildLineCore = (type, def, pName, fName) => { - return `* @param {${type}} ${pName}${fName}${def !== undefined ? `=${def}` : ''}`; + const paramName = `${pName}${fName}`; + const defaultValue = def !== undefined ? `=${def}` : ''; + return `* @param {${type}} ${paramName}${defaultValue}`; }; - + const buildLine = (f, fName, pName) => { const type = getType(f); const def = getDefault(f, type);