Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function findValueForLocale(literals, locale) {
if (!literals) return null;
const literal = literals.find(isLiteralWithLocale(locale))
|| literals.find(isLiteralWithLocale(englishLocale))
|| literals[0];
return isLiteral(literal) ? getLiteralValue(literal) : null;
}
const isLiteralWithLocale = locale => l => isLiteral(l) && getLiteralLanguage(l) === locale;