@formatjs/intl-enumerator
Version:
Intl.Enumerator polyfill
17 lines (16 loc) • 639 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSupportedCollations = getSupportedCollations;
var collations_generated_1 = require("./collations.generated");
function isSupported(collation, locale) {
if (locale === void 0) { locale = 'en'; }
try {
return (Intl.Collator("".concat(locale, "-u-co-").concat(collation)).resolvedOptions()
.collation === collation);
}
catch (_err) { }
return false;
}
function getSupportedCollations(locale) {
return collations_generated_1.collations.filter(function (collation) { return isSupported(collation, locale); });
}