From 860374fdab25fce3161ee835be0e141a341b9b9b Mon Sep 17 00:00:00 2001 From: Cashew <52880648+Scrub1492@users.noreply.github.com> Date: Wed, 27 Dec 2023 13:41:35 +0700 Subject: switch updates (#459) * switch updates * revert to if-else * revert to if-else * remove empty default --- ext/js/display/display-generator.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'ext/js/display') diff --git a/ext/js/display/display-generator.js b/ext/js/display/display-generator.js index 920d2c94..b91d0ce9 100644 --- a/ext/js/display/display-generator.js +++ b/ext/js/display/display-generator.js @@ -401,14 +401,19 @@ export class DisplayGenerator { * @returns {?HTMLElement} */ _createTermDefinitionEntry(entry, dictionary) { - if (typeof entry === 'string') { - return this._createTermDefinitionEntryText(entry); - } else if (typeof entry === 'object' && entry !== null) { - switch (entry.type) { - case 'image': - return this._createTermDefinitionEntryImage(entry, dictionary); - case 'structured-content': - return this._createTermDefinitionEntryStructuredContent(entry.content, dictionary); + switch (typeof entry) { + case 'string': + return this._createTermDefinitionEntryText(entry); + case 'object': { + switch (entry.type) { + case 'image': + return this._createTermDefinitionEntryImage(entry, dictionary); + case 'structured-content': + return this._createTermDefinitionEntryStructuredContent(entry.content, dictionary); + case 'text': + break; + } + break; } } -- cgit v1.2.3