@formatjs/intl-enumerator
Version:
Intl.Enumerator polyfill
18 lines (17 loc) • 904 B
JavaScript
import { getSupportedCalendars } from "./get-supported-calendars.js";
import { getSupportedCollations } from "./get-supported-collations.js";
import { getSupportedCurrencies } from "./get-supported-currencies.js";
import { getSupportedNumberingSystems } from "./get-supported-numbering-systems.js";
import { getSupportedTimeZones } from "./get-supported-timezones.js";
import { getSupportedUnits } from "./get-supported-units.js";
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);
}
}