tools/gulp-tasks/cldr/extract.js
function getCurrencySettings(locale, localeData) {
  const currencyInfo = localeData.main(`numbers/currencies`);
  let currentCurrency = '';

  // find the currency currently used in this country
  const currencies =
    localeData.get(`supplemental/currencyData/region/${localeData.attributes.territory}`) ||
    localeData.get(`supplemental/currencyData/region/${localeData.attributes.language.toUpperCase()}`);

  if (currencies) {
    currencies.some(currency => {
      const keys = Object.keys(currency);
      return keys.some(key => {
        if (currency[key]._from && !currency[key]._to) {
          return currentCurrency = key;
        }
      });
    });

    if (!currentCurrency) {
      throw new Error(`Unable to find currency for locale "${locale}"`);
    }
  }

  let currencySettings = [undefined, undefined];

  if (currentCurrency) {
    currencySettings = [currencyInfo[currentCurrency].symbol, currencyInfo[currentCurrency].displayName];
  }

  return currencySettings;
}
function getCurrencySettings(locale, localeData) {
  const currencyInfo = localeData.main(`numbers/currencies`);
  let currentCurrency = '';

  // find the currency currently used in this country
  const currencies =
    localeData.get(`supplemental/currencyData/region/${localeData.attributes.territory}`) ||
    localeData.get(`supplemental/currencyData/region/${localeData.attributes.language.toUpperCase()}`);

  if (currencies) {
    currencies.some(currency => {
      const keys = Object.keys(currency);
      return keys.some(key => {
        if (currency[key]._from && !currency[key]._to) {
          return currentCurrency = key;
        }
      });
    });

    if (!currentCurrency) {
      throw new Error(`Unable to find currency for locale "${locale}"`);
    }
  }

  let currencySettings = [undefined, undefined];

  if (currentCurrency) {
    currencySettings = [currencyInfo[currentCurrency].symbol, currencyInfo[currentCurrency].displayName];
  }

  return currencySettings;
}
function getCurrencySettings ( locale , localeData ) { const currencyInfo = localeData . main ( ` ` ) ; let currentCurrency = '' ; // find the currency currently used in this country const currencies = localeData . get ( ` ${ localeData . attributes . territory } ` ) || localeData . get ( ` ${ localeData . attributes . language . toUpperCase ( ) } ` ) ; if ( currencies ) { currencies . some ( currency => { const keys = Object . keys ( currency ) ; return keys . some ( key => { if ( currency [ key ] . _from && ! currency [ key ] . _to ) { return currentCurrency = key ; } } ) ; } ) ; if ( ! currentCurrency ) { throw new Error ( ` ${ locale } ` ) ; } } let currencySettings = [ undefined , undefined ] ; if ( currentCurrency ) { currencySettings = [ currencyInfo [ currentCurrency ] . symbol , currencyInfo [ currentCurrency ] . displayName ] ; } return currencySettings ; }
Returns the currency symbol and name for a locale
@returns [ symbol, name ]
Returns the currency symbol and name for a locale