mirror of https://github.com/zulip/zulip.git
js: Avoid _.get.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
cc40352541
commit
392676d4da
|
@ -260,7 +260,7 @@ function retain_unique_language_aliases(matches) {
|
|||
for (const lang of matches) {
|
||||
// The matched list is already sorted based on popularity and has exact matches
|
||||
// at the top, so we don't need to worry about sorting again.
|
||||
const canonical_name = _.get(pygments_data.langs, [lang, "pretty_name"], lang);
|
||||
const canonical_name = pygments_data.langs[lang]?.pretty_name ?? lang;
|
||||
if (!seen_aliases.has(canonical_name)) {
|
||||
seen_aliases.add(canonical_name);
|
||||
unique_aliases.push(lang);
|
||||
|
|
|
@ -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>`;
|
||||
|
|
Loading…
Reference in New Issue