@formatjs/intl-enumerator
Version:
Intl.Enumerator polyfill
25 lines (24 loc) • 1.02 kB
JavaScript
import { getSupportedCalendars } from './get-supported-calendars';
import { getSupportedCollations } from './get-supported-collations';
import { getSupportedCurrencies } from './get-supported-currencies';
import { getSupportedNumberingSystems } from './get-supported-numbering-systems';
import { getSupportedTimeZones } from './get-supported-timezones';
import { getSupportedUnits } from './get-supported-units';
export function supportedValuesOf(key, locale) {
switch (key) {
case 'calendar':
return getSupportedCalendars(locale);
case 'collation':
return getSupportedCollations(locale);
case 'currency':
return getSupportedCurrencies(locale);
case 'numberingSystem':
return getSupportedNumberingSystems(locale);
case 'timeZone':
return getSupportedTimeZones(locale);
case 'unit':
return getSupportedUnits(locale);
default:
throw RangeError('Invalid key: ' + key);
}
}