Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const extractLanguageDataForLocale = locale => {
// Get the list of all languages.
const languages = cldr.extractLanguageSupplementalData(locale);
// Get the list of all remaining languages.
const oldLanguages = cldr.extractLanguageSupplementalMetadata(locale);
// Get the list of all language names
const languageNames = cldr.extractLanguageDisplayNames(locale);
/* Here we are filtering the oldLanguages for having only the ones that
* are not deprecated and has a key or its replacement key with length of 2
* as stipulated by the ISO 639 (1, 2)
*
* Let's say that we got this coming from cldr
* {
* bh: { replacement: 'bhr', reason: 'legacy'},
* tr: { replacement: 'thr', reason: 'deprecated'},
* mar: { replacement: 'ma', reason: 'legacy'},
* adr: { replacement: 'adr-a', reason: 'legacy'},
* }
*
* The output with the following function would be: