1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | Object.defineProperty(exports, "__esModule", { value: true });
|
8 | function areIntlLocalesSupported(locales, constructorsToCheck) {
|
9 | if (typeof Intl === 'undefined') {
|
10 | return false;
|
11 | }
|
12 | if (!locales) {
|
13 | throw new Error('locales must be supplied.');
|
14 | }
|
15 | if (!Array.isArray(locales)) {
|
16 | locales = [locales];
|
17 | }
|
18 | var intlConstructors = constructorsToCheck || [
|
19 | Intl.DateTimeFormat,
|
20 | Intl.NumberFormat,
|
21 | Intl.PluralRules,
|
22 | ];
|
23 | intlConstructors = intlConstructors.filter(Boolean);
|
24 | if (intlConstructors.length === 0 ||
|
25 | (constructorsToCheck &&
|
26 | intlConstructors.length !== constructorsToCheck.length)) {
|
27 | return false;
|
28 | }
|
29 | return intlConstructors.every(function (intlConstructor) {
|
30 | return intlConstructor.supportedLocalesOf(locales).length === locales.length;
|
31 | });
|
32 | }
|
33 | exports.default = areIntlLocalesSupported;
|
34 |
|
\ | No newline at end of file |