mirror of
https://github.com/imputnet/cobalt.git
synced 2026-03-09 07:17:16 -05:00
api/language-codes: prevent errors if code is undefined
This commit is contained in:
@@ -49,6 +49,6 @@ const maps = {
|
||||
}
|
||||
|
||||
export const convertLanguageCode = (code) => {
|
||||
code = code.split("-")[0].split("_")[0];
|
||||
code = code?.split("-")[0]?.split("_")[0] || "";
|
||||
return maps[code.length]?.[code.toLowerCase()] || null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user