mirror of
https://github.com/imputnet/cobalt.git
synced 2025-12-11 04:22:49 +00:00
api/language-codes: prevent errors if code is undefined
This commit is contained in:
parent
810e0a865c
commit
f3992fbe33
@ -49,6 +49,6 @@ const maps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const convertLanguageCode = (code) => {
|
export const convertLanguageCode = (code) => {
|
||||||
code = code.split("-")[0].split("_")[0];
|
code = code?.split("-")[0]?.split("_")[0] || "";
|
||||||
return maps[code.length]?.[code.toLowerCase()] || null;
|
return maps[code.length]?.[code.toLowerCase()] || null;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user