js: Avoid _.get.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2022-01-24 00:27:28 -08:00
committed by Tim Abbott
parent cc40352541
commit 392676d4da
2 changed files with 2 additions and 2 deletions

View File

@@ -46,7 +46,7 @@ export function wrap_code(code, lang) {
// the `/shared` folder. To handle such a case we check if pygments data is empty and fallback to
// using the default header if it is.
if (lang !== undefined && lang !== "" && Object.keys(pygments_data).length > 0) {
const code_language = _.get(pygments_data, [lang, "pretty_name"], lang);
const code_language = pygments_data[lang]?.pretty_name ?? lang;
header = `<div class="codehilite" data-code-language="${_.escape(
code_language,
)}"><pre><span></span><code>`;