Skip to content

Commit

Permalink
refactor: simplify generateFile function with optional chaining exp…
Browse files Browse the repository at this point in the history
…ression (#1306)

Co-authored-by: Lukasz Gornicki <lpgornicki@gmail.com>
  • Loading branch information
D-I-R-M and derberg authored Oct 21, 2024
1 parent cb375c4 commit aa79245
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/generator/lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit aa79245

Please sign in to comment.