From aa7924510d7e94f177c6ff22d5a2724eafe7b2d0 Mon Sep 17 00:00:00 2001 From: D-I-R-M <159949232+D-I-R-M@users.noreply.github.com> Date: Mon, 21 Oct 2024 18:05:32 +0530 Subject: [PATCH] refactor: simplify `generateFile` function with optional chaining expression (#1306) Co-authored-by: Lukasz Gornicki --- apps/generator/lib/generator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(),