@formatjs/intl-locale 3.4.2 → 3.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 FormatJS
3
+ Copyright (c) 2023 FormatJS
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.calendars = void 0;
4
1
  /* @generated */
5
2
  // prettier-ignore
6
- exports.calendars = {
3
+ export var calendars = {
7
4
  "001": [
8
5
  "gregorian"
9
6
  ],
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.characterOrders = void 0;
4
1
  /* @generated */
5
2
  // prettier-ignore
6
- exports.characterOrders = {
3
+ export var characterOrders = {
7
4
  "aa": "left-to-right",
8
5
  "aa-DJ": "left-to-right",
9
6
  "aa-ER": "left-to-right",
@@ -1,9 +1,7 @@
1
- "use strict";
2
1
  // Type-only circular import
3
2
  // eslint-disable-next-line import/no-cycle
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
3
  var internalSlotMap = new WeakMap();
6
- function getInternalSlots(x) {
4
+ export default function getInternalSlots(x) {
7
5
  var internalSlots = internalSlotMap.get(x);
8
6
  if (!internalSlots) {
9
7
  internalSlots = Object.create(null);
@@ -11,4 +9,3 @@ function getInternalSlots(x) {
11
9
  }
12
10
  return internalSlots;
13
11
  }
14
- exports.default = getInternalSlots;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hourCycles = void 0;
4
1
  /* @generated */
5
2
  // prettier-ignore
6
- exports.hourCycles = {
3
+ export var hourCycles = {
7
4
  "001": [
8
5
  "h23",
9
6
  "h12"
package/lib/index.js CHANGED
@@ -1,32 +1,29 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Locale = void 0;
4
- var tslib_1 = require("tslib");
5
- var intl_enumerator_1 = require("@formatjs/intl-enumerator");
6
- var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
7
- var intl_getcanonicallocales_1 = require("@formatjs/intl-getcanonicallocales");
8
- var get_internal_slots_1 = tslib_1.__importDefault(require("./get_internal_slots"));
9
- var preference_data_1 = require("./preference-data");
10
- var character_orders_generated_1 = require("./character-orders.generated");
11
- var numbering_systems_generated_1 = require("./numbering-systems.generated");
1
+ import { __assign, __spreadArray } from "tslib";
2
+ import { supportedValuesOf } from '@formatjs/intl-enumerator';
3
+ import { defineProperty, GetOption, invariant, SameValue, CoerceOptionsToObject, } from '@formatjs/ecma402-abstract';
4
+ import { isStructurallyValidLanguageTag, isUnicodeLanguageSubtag, isUnicodeRegionSubtag, parseUnicodeLanguageId, isUnicodeScriptSubtag, emitUnicodeLocaleId, parseUnicodeLocaleId, emitUnicodeLanguageId, likelySubtags, } from '@formatjs/intl-getcanonicallocales';
5
+ import getInternalSlots from './get_internal_slots';
6
+ import { getCalendarPreferenceDataForRegion, getHourCyclesPreferenceDataForLocaleOrRegion, getTimeZonePreferenceForRegion, getWeekDataForRegion, } from './preference-data';
7
+ import { characterOrders } from './character-orders.generated';
8
+ import { numberingSystems } from './numbering-systems.generated';
12
9
  var RELEVANT_EXTENSION_KEYS = ['ca', 'co', 'hc', 'kf', 'kn', 'nu'];
13
10
  var UNICODE_TYPE_REGEX = /^[a-z0-9]{3,8}(-[a-z0-9]{3,8})*$/i;
14
11
  function applyOptionsToTag(tag, options) {
15
- (0, ecma402_abstract_1.invariant)(typeof tag === 'string', 'language tag must be a string');
16
- (0, ecma402_abstract_1.invariant)((0, intl_getcanonicallocales_1.isStructurallyValidLanguageTag)(tag), 'malformed language tag', RangeError);
17
- var language = (0, ecma402_abstract_1.GetOption)(options, 'language', 'string', undefined, undefined);
12
+ invariant(typeof tag === 'string', 'language tag must be a string');
13
+ invariant(isStructurallyValidLanguageTag(tag), 'malformed language tag', RangeError);
14
+ var language = GetOption(options, 'language', 'string', undefined, undefined);
18
15
  if (language !== undefined) {
19
- (0, ecma402_abstract_1.invariant)((0, intl_getcanonicallocales_1.isUnicodeLanguageSubtag)(language), 'Malformed unicode_language_subtag', RangeError);
16
+ invariant(isUnicodeLanguageSubtag(language), 'Malformed unicode_language_subtag', RangeError);
20
17
  }
21
- var script = (0, ecma402_abstract_1.GetOption)(options, 'script', 'string', undefined, undefined);
18
+ var script = GetOption(options, 'script', 'string', undefined, undefined);
22
19
  if (script !== undefined) {
23
- (0, ecma402_abstract_1.invariant)((0, intl_getcanonicallocales_1.isUnicodeScriptSubtag)(script), 'Malformed unicode_script_subtag', RangeError);
20
+ invariant(isUnicodeScriptSubtag(script), 'Malformed unicode_script_subtag', RangeError);
24
21
  }
25
- var region = (0, ecma402_abstract_1.GetOption)(options, 'region', 'string', undefined, undefined);
22
+ var region = GetOption(options, 'region', 'string', undefined, undefined);
26
23
  if (region !== undefined) {
27
- (0, ecma402_abstract_1.invariant)((0, intl_getcanonicallocales_1.isUnicodeRegionSubtag)(region), 'Malformed unicode_region_subtag', RangeError);
24
+ invariant(isUnicodeRegionSubtag(region), 'Malformed unicode_region_subtag', RangeError);
28
25
  }
29
- var languageId = (0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(tag);
26
+ var languageId = parseUnicodeLanguageId(tag);
30
27
  if (language !== undefined) {
31
28
  languageId.lang = language;
32
29
  }
@@ -36,12 +33,12 @@ function applyOptionsToTag(tag, options) {
36
33
  if (region !== undefined) {
37
34
  languageId.region = region;
38
35
  }
39
- return Intl.getCanonicalLocales((0, intl_getcanonicallocales_1.emitUnicodeLocaleId)(tslib_1.__assign(tslib_1.__assign({}, (0, intl_getcanonicallocales_1.parseUnicodeLocaleId)(tag)), { lang: languageId })))[0];
36
+ return Intl.getCanonicalLocales(emitUnicodeLocaleId(__assign(__assign({}, parseUnicodeLocaleId(tag)), { lang: languageId })))[0];
40
37
  }
41
38
  function applyUnicodeExtensionToTag(tag, options, relevantExtensionKeys) {
42
39
  var unicodeExtension;
43
40
  var keywords = [];
44
- var ast = (0, intl_getcanonicallocales_1.parseUnicodeLocaleId)(tag);
41
+ var ast = parseUnicodeLocaleId(tag);
45
42
  for (var _i = 0, _a = ast.extensions; _i < _a.length; _i++) {
46
43
  var ext = _a[_i];
47
44
  if (ext.type === 'u') {
@@ -61,10 +58,10 @@ function applyUnicodeExtensionToTag(tag, options, relevantExtensionKeys) {
61
58
  value = entry[1];
62
59
  }
63
60
  }
64
- (0, ecma402_abstract_1.invariant)(key in options, "".concat(key, " must be in options"));
61
+ invariant(key in options, "".concat(key, " must be in options"));
65
62
  var optionsValue = options[key];
66
63
  if (optionsValue !== undefined) {
67
- (0, ecma402_abstract_1.invariant)(typeof optionsValue === 'string', "Value for ".concat(key, " must be a string"));
64
+ invariant(typeof optionsValue === 'string', "Value for ".concat(key, " must be a string"));
68
65
  value = optionsValue;
69
66
  if (entry) {
70
67
  entry[1] = value;
@@ -87,7 +84,7 @@ function applyUnicodeExtensionToTag(tag, options, relevantExtensionKeys) {
87
84
  else {
88
85
  unicodeExtension.keywords = keywords;
89
86
  }
90
- result.locale = Intl.getCanonicalLocales((0, intl_getcanonicallocales_1.emitUnicodeLocaleId)(ast))[0];
87
+ result.locale = Intl.getCanonicalLocales(emitUnicodeLocaleId(ast))[0];
91
88
  return result;
92
89
  }
93
90
  function mergeUnicodeLanguageId(lang, script, region, variants, replacement) {
@@ -104,45 +101,45 @@ function mergeUnicodeLanguageId(lang, script, region, variants, replacement) {
104
101
  lang: !lang || lang === 'und' ? replacement.lang : lang,
105
102
  script: script || replacement.script,
106
103
  region: region || replacement.region,
107
- variants: tslib_1.__spreadArray(tslib_1.__spreadArray([], variants, true), replacement.variants, true),
104
+ variants: __spreadArray(__spreadArray([], variants, true), replacement.variants, true),
108
105
  };
109
106
  }
110
107
  function addLikelySubtags(tag) {
111
- var ast = (0, intl_getcanonicallocales_1.parseUnicodeLocaleId)(tag);
108
+ var ast = parseUnicodeLocaleId(tag);
112
109
  var unicodeLangId = ast.lang;
113
110
  var lang = unicodeLangId.lang, script = unicodeLangId.script, region = unicodeLangId.region, variants = unicodeLangId.variants;
114
111
  if (script && region) {
115
- var match_1 = intl_getcanonicallocales_1.likelySubtags[(0, intl_getcanonicallocales_1.emitUnicodeLanguageId)({ lang: lang, script: script, region: region, variants: [] })];
112
+ var match_1 = likelySubtags[emitUnicodeLanguageId({ lang: lang, script: script, region: region, variants: [] })];
116
113
  if (match_1) {
117
- var parts_1 = (0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(match_1);
114
+ var parts_1 = parseUnicodeLanguageId(match_1);
118
115
  ast.lang = mergeUnicodeLanguageId(undefined, undefined, undefined, variants, parts_1);
119
- return (0, intl_getcanonicallocales_1.emitUnicodeLocaleId)(ast);
116
+ return emitUnicodeLocaleId(ast);
120
117
  }
121
118
  }
122
119
  if (script) {
123
- var match_2 = intl_getcanonicallocales_1.likelySubtags[(0, intl_getcanonicallocales_1.emitUnicodeLanguageId)({ lang: lang, script: script, variants: [] })];
120
+ var match_2 = likelySubtags[emitUnicodeLanguageId({ lang: lang, script: script, variants: [] })];
124
121
  if (match_2) {
125
- var parts_2 = (0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(match_2);
122
+ var parts_2 = parseUnicodeLanguageId(match_2);
126
123
  ast.lang = mergeUnicodeLanguageId(undefined, undefined, region, variants, parts_2);
127
- return (0, intl_getcanonicallocales_1.emitUnicodeLocaleId)(ast);
124
+ return emitUnicodeLocaleId(ast);
128
125
  }
129
126
  }
130
127
  if (region) {
131
- var match_3 = intl_getcanonicallocales_1.likelySubtags[(0, intl_getcanonicallocales_1.emitUnicodeLanguageId)({ lang: lang, region: region, variants: [] })];
128
+ var match_3 = likelySubtags[emitUnicodeLanguageId({ lang: lang, region: region, variants: [] })];
132
129
  if (match_3) {
133
- var parts_3 = (0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(match_3);
130
+ var parts_3 = parseUnicodeLanguageId(match_3);
134
131
  ast.lang = mergeUnicodeLanguageId(undefined, script, undefined, variants, parts_3);
135
- return (0, intl_getcanonicallocales_1.emitUnicodeLocaleId)(ast);
132
+ return emitUnicodeLocaleId(ast);
136
133
  }
137
134
  }
138
- var match = intl_getcanonicallocales_1.likelySubtags[lang] ||
139
- intl_getcanonicallocales_1.likelySubtags[(0, intl_getcanonicallocales_1.emitUnicodeLanguageId)({ lang: 'und', script: script, variants: [] })];
135
+ var match = likelySubtags[lang] ||
136
+ likelySubtags[emitUnicodeLanguageId({ lang: 'und', script: script, variants: [] })];
140
137
  if (!match) {
141
138
  throw new Error("No match for addLikelySubtags");
142
139
  }
143
- var parts = (0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(match);
140
+ var parts = parseUnicodeLanguageId(match);
144
141
  ast.lang = mergeUnicodeLanguageId(undefined, script, region, variants, parts);
145
- return (0, intl_getcanonicallocales_1.emitUnicodeLocaleId)(ast);
142
+ return emitUnicodeLocaleId(ast);
146
143
  }
147
144
  /**
148
145
  * From: https://github.com/unicode-org/icu/blob/4231ca5be053a22a1be24eb891817458c97db709/icu4j/main/classes/core/src/com/ibm/icu/util/ULocale.java#L2395
@@ -153,23 +150,23 @@ function removeLikelySubtags(tag) {
153
150
  if (!maxLocale) {
154
151
  return tag;
155
152
  }
156
- maxLocale = (0, intl_getcanonicallocales_1.emitUnicodeLanguageId)(tslib_1.__assign(tslib_1.__assign({}, (0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(maxLocale)), { variants: [] }));
157
- var ast = (0, intl_getcanonicallocales_1.parseUnicodeLocaleId)(tag);
153
+ maxLocale = emitUnicodeLanguageId(__assign(__assign({}, parseUnicodeLanguageId(maxLocale)), { variants: [] }));
154
+ var ast = parseUnicodeLocaleId(tag);
158
155
  var _a = ast.lang, lang = _a.lang, script = _a.script, region = _a.region, variants = _a.variants;
159
- var trial = addLikelySubtags((0, intl_getcanonicallocales_1.emitUnicodeLanguageId)({ lang: lang, variants: [] }));
156
+ var trial = addLikelySubtags(emitUnicodeLanguageId({ lang: lang, variants: [] }));
160
157
  if (trial === maxLocale) {
161
- return (0, intl_getcanonicallocales_1.emitUnicodeLocaleId)(tslib_1.__assign(tslib_1.__assign({}, ast), { lang: mergeUnicodeLanguageId(lang, undefined, undefined, variants) }));
158
+ return emitUnicodeLocaleId(__assign(__assign({}, ast), { lang: mergeUnicodeLanguageId(lang, undefined, undefined, variants) }));
162
159
  }
163
160
  if (region) {
164
- var trial_1 = addLikelySubtags((0, intl_getcanonicallocales_1.emitUnicodeLanguageId)({ lang: lang, region: region, variants: [] }));
161
+ var trial_1 = addLikelySubtags(emitUnicodeLanguageId({ lang: lang, region: region, variants: [] }));
165
162
  if (trial_1 === maxLocale) {
166
- return (0, intl_getcanonicallocales_1.emitUnicodeLocaleId)(tslib_1.__assign(tslib_1.__assign({}, ast), { lang: mergeUnicodeLanguageId(lang, undefined, region, variants) }));
163
+ return emitUnicodeLocaleId(__assign(__assign({}, ast), { lang: mergeUnicodeLanguageId(lang, undefined, region, variants) }));
167
164
  }
168
165
  }
169
166
  if (script) {
170
- var trial_2 = addLikelySubtags((0, intl_getcanonicallocales_1.emitUnicodeLanguageId)({ lang: lang, script: script, variants: [] }));
167
+ var trial_2 = addLikelySubtags(emitUnicodeLanguageId({ lang: lang, script: script, variants: [] }));
171
168
  if (trial_2 === maxLocale) {
172
- return (0, intl_getcanonicallocales_1.emitUnicodeLocaleId)(tslib_1.__assign(tslib_1.__assign({}, ast), { lang: mergeUnicodeLanguageId(lang, script, undefined, variants) }));
169
+ return emitUnicodeLocaleId(__assign(__assign({}, ast), { lang: mergeUnicodeLanguageId(lang, script, undefined, variants) }));
173
170
  }
174
171
  }
175
172
  return tag;
@@ -182,55 +179,55 @@ function createArrayFromListOrRestricted(list, restricted) {
182
179
  return Array.from(result);
183
180
  }
184
181
  function calendarsOfLocale(loc) {
185
- var locInternalSlots = (0, get_internal_slots_1.default)(loc);
182
+ var locInternalSlots = getInternalSlots(loc);
186
183
  var restricted = locInternalSlots.calendar;
187
184
  var locale = locInternalSlots.locale;
188
185
  var region;
189
186
  if (locale !== 'root') {
190
187
  region = loc.maximize().region;
191
188
  }
192
- var preferredCalendars = (0, preference_data_1.getCalendarPreferenceDataForRegion)(region);
189
+ var preferredCalendars = getCalendarPreferenceDataForRegion(region);
193
190
  return createArrayFromListOrRestricted(preferredCalendars, restricted);
194
191
  }
195
192
  function collationsOfLocale(loc) {
196
- var locInternalSlots = (0, get_internal_slots_1.default)(loc);
193
+ var locInternalSlots = getInternalSlots(loc);
197
194
  var restricted = locInternalSlots.collation;
198
195
  var locale = locInternalSlots.locale;
199
- var supportedCollations = (0, intl_enumerator_1.supportedValuesOf)('collation', locale).filter(function (co) { return co !== 'standard' && co !== 'search'; });
196
+ var supportedCollations = supportedValuesOf('collation', locale).filter(function (co) { return co !== 'standard' && co !== 'search'; });
200
197
  supportedCollations.sort();
201
198
  return createArrayFromListOrRestricted(supportedCollations, restricted);
202
199
  }
203
200
  function hourCyclesOfLocale(loc) {
204
- var locInternalSlots = (0, get_internal_slots_1.default)(loc);
201
+ var locInternalSlots = getInternalSlots(loc);
205
202
  var restricted = locInternalSlots.hourCycle;
206
203
  var locale = locInternalSlots.locale;
207
204
  var region;
208
205
  if (locale !== 'root') {
209
206
  region = loc.maximize().region;
210
207
  }
211
- var preferredHourCycles = (0, preference_data_1.getHourCyclesPreferenceDataForLocaleOrRegion)(locale, region);
208
+ var preferredHourCycles = getHourCyclesPreferenceDataForLocaleOrRegion(locale, region);
212
209
  return createArrayFromListOrRestricted(preferredHourCycles, restricted);
213
210
  }
214
211
  function numberingSystemsOfLocale(loc) {
215
212
  var _a;
216
- var locInternalSlots = (0, get_internal_slots_1.default)(loc);
213
+ var locInternalSlots = getInternalSlots(loc);
217
214
  var restricted = locInternalSlots.numberingSystem;
218
215
  var locale = locInternalSlots.locale;
219
216
  var language = loc.language;
220
- var localeNumberingSystems = (_a = numbering_systems_generated_1.numberingSystems[locale]) !== null && _a !== void 0 ? _a : numbering_systems_generated_1.numberingSystems[language];
217
+ var localeNumberingSystems = (_a = numberingSystems[locale]) !== null && _a !== void 0 ? _a : numberingSystems[language];
221
218
  if (localeNumberingSystems) {
222
- return createArrayFromListOrRestricted(tslib_1.__spreadArray([], localeNumberingSystems, true), restricted);
219
+ return createArrayFromListOrRestricted(__spreadArray([], localeNumberingSystems, true), restricted);
223
220
  }
224
221
  return createArrayFromListOrRestricted([], restricted);
225
222
  }
226
223
  function timeZonesOfLocale(loc) {
227
- var locInternalSlots = (0, get_internal_slots_1.default)(loc);
224
+ var locInternalSlots = getInternalSlots(loc);
228
225
  var locale = locInternalSlots.locale;
229
- var region = (0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(locale).region;
226
+ var region = parseUnicodeLanguageId(locale).region;
230
227
  if (!region) {
231
228
  return undefined;
232
229
  }
233
- var preferredTimeZones = (0, preference_data_1.getTimeZonePreferenceForRegion)(region);
230
+ var preferredTimeZones = getTimeZonePreferenceForRegion(region);
234
231
  preferredTimeZones.sort();
235
232
  return Array.from(preferredTimeZones);
236
233
  }
@@ -241,18 +238,18 @@ function translateCharacterOrder(order) {
241
238
  return 'ltr';
242
239
  }
243
240
  function characterDirectionOfLocale(loc) {
244
- var locInternalSlots = (0, get_internal_slots_1.default)(loc);
241
+ var locInternalSlots = getInternalSlots(loc);
245
242
  var locale = locInternalSlots.locale;
246
- return translateCharacterOrder(character_orders_generated_1.characterOrders[locale]);
243
+ return translateCharacterOrder(characterOrders[locale]);
247
244
  }
248
245
  function weekInfoOfLocale(loc) {
249
- var locInternalSlots = (0, get_internal_slots_1.default)(loc);
246
+ var locInternalSlots = getInternalSlots(loc);
250
247
  var locale = locInternalSlots.locale;
251
248
  var region;
252
249
  if (locale !== 'root') {
253
250
  region = loc.maximize().region;
254
251
  }
255
- return (0, preference_data_1.getWeekDataForRegion)(region);
252
+ return getWeekDataForRegion(region);
256
253
  }
257
254
  var Locale = /** @class */ (function () {
258
255
  function Locale(tag, opts) {
@@ -285,42 +282,42 @@ var Locale = /** @class */ (function () {
285
282
  }
286
283
  var internalSlots;
287
284
  if (typeof tag === 'object' &&
288
- (internalSlots = (0, get_internal_slots_1.default)(tag)) &&
285
+ (internalSlots = getInternalSlots(tag)) &&
289
286
  internalSlots.initializedLocale) {
290
287
  tag = internalSlots.locale;
291
288
  }
292
289
  else {
293
290
  tag = tag.toString();
294
291
  }
295
- internalSlots = (0, get_internal_slots_1.default)(this);
296
- var options = (0, ecma402_abstract_1.CoerceOptionsToObject)(opts);
292
+ internalSlots = getInternalSlots(this);
293
+ var options = CoerceOptionsToObject(opts);
297
294
  tag = applyOptionsToTag(tag, options);
298
295
  var opt = Object.create(null);
299
- var calendar = (0, ecma402_abstract_1.GetOption)(options, 'calendar', 'string', undefined, undefined);
296
+ var calendar = GetOption(options, 'calendar', 'string', undefined, undefined);
300
297
  if (calendar !== undefined) {
301
298
  if (!UNICODE_TYPE_REGEX.test(calendar)) {
302
299
  throw new RangeError('invalid calendar');
303
300
  }
304
301
  }
305
302
  opt.ca = calendar;
306
- var collation = (0, ecma402_abstract_1.GetOption)(options, 'collation', 'string', undefined, undefined);
303
+ var collation = GetOption(options, 'collation', 'string', undefined, undefined);
307
304
  if (collation !== undefined) {
308
305
  if (!UNICODE_TYPE_REGEX.test(collation)) {
309
306
  throw new RangeError('invalid collation');
310
307
  }
311
308
  }
312
309
  opt.co = collation;
313
- var hc = (0, ecma402_abstract_1.GetOption)(options, 'hourCycle', 'string', ['h11', 'h12', 'h23', 'h24'], undefined);
310
+ var hc = GetOption(options, 'hourCycle', 'string', ['h11', 'h12', 'h23', 'h24'], undefined);
314
311
  opt.hc = hc;
315
- var kf = (0, ecma402_abstract_1.GetOption)(options, 'caseFirst', 'string', ['upper', 'lower', 'false'], undefined);
312
+ var kf = GetOption(options, 'caseFirst', 'string', ['upper', 'lower', 'false'], undefined);
316
313
  opt.kf = kf;
317
- var _kn = (0, ecma402_abstract_1.GetOption)(options, 'numeric', 'boolean', undefined, undefined);
314
+ var _kn = GetOption(options, 'numeric', 'boolean', undefined, undefined);
318
315
  var kn;
319
316
  if (_kn !== undefined) {
320
317
  kn = String(_kn);
321
318
  }
322
319
  opt.kn = kn;
323
- var numberingSystem = (0, ecma402_abstract_1.GetOption)(options, 'numberingSystem', 'string', undefined, undefined);
320
+ var numberingSystem = GetOption(options, 'numberingSystem', 'string', undefined, undefined);
324
321
  if (numberingSystem !== undefined) {
325
322
  if (!UNICODE_TYPE_REGEX.test(numberingSystem)) {
326
323
  throw new RangeError('Invalid numberingSystem');
@@ -336,7 +333,7 @@ var Locale = /** @class */ (function () {
336
333
  internalSlots.caseFirst = r.kf;
337
334
  }
338
335
  if (relevantExtensionKeys.indexOf('kn') > -1) {
339
- internalSlots.numeric = (0, ecma402_abstract_1.SameValue)(r.kn, 'true');
336
+ internalSlots.numeric = SameValue(r.kn, 'true');
340
337
  }
341
338
  internalSlots.numberingSystem = r.nu;
342
339
  }
@@ -344,7 +341,7 @@ var Locale = /** @class */ (function () {
344
341
  * https://www.unicode.org/reports/tr35/#Likely_Subtags
345
342
  */
346
343
  Locale.prototype.maximize = function () {
347
- var locale = (0, get_internal_slots_1.default)(this).locale;
344
+ var locale = getInternalSlots(this).locale;
348
345
  try {
349
346
  var maximizedLocale = addLikelySubtags(locale);
350
347
  return new Locale(maximizedLocale);
@@ -357,7 +354,7 @@ var Locale = /** @class */ (function () {
357
354
  * https://www.unicode.org/reports/tr35/#Likely_Subtags
358
355
  */
359
356
  Locale.prototype.minimize = function () {
360
- var locale = (0, get_internal_slots_1.default)(this).locale;
357
+ var locale = getInternalSlots(this).locale;
361
358
  try {
362
359
  var minimizedLocale = removeLikelySubtags(locale);
363
360
  return new Locale(minimizedLocale);
@@ -367,54 +364,54 @@ var Locale = /** @class */ (function () {
367
364
  }
368
365
  };
369
366
  Locale.prototype.toString = function () {
370
- return (0, get_internal_slots_1.default)(this).locale;
367
+ return getInternalSlots(this).locale;
371
368
  };
372
369
  Object.defineProperty(Locale.prototype, "baseName", {
373
370
  get: function () {
374
- var locale = (0, get_internal_slots_1.default)(this).locale;
375
- return (0, intl_getcanonicallocales_1.emitUnicodeLanguageId)((0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(locale));
371
+ var locale = getInternalSlots(this).locale;
372
+ return emitUnicodeLanguageId(parseUnicodeLanguageId(locale));
376
373
  },
377
374
  enumerable: false,
378
375
  configurable: true
379
376
  });
380
377
  Object.defineProperty(Locale.prototype, "calendar", {
381
378
  get: function () {
382
- return (0, get_internal_slots_1.default)(this).calendar;
379
+ return getInternalSlots(this).calendar;
383
380
  },
384
381
  enumerable: false,
385
382
  configurable: true
386
383
  });
387
384
  Object.defineProperty(Locale.prototype, "collation", {
388
385
  get: function () {
389
- return (0, get_internal_slots_1.default)(this).collation;
386
+ return getInternalSlots(this).collation;
390
387
  },
391
388
  enumerable: false,
392
389
  configurable: true
393
390
  });
394
391
  Object.defineProperty(Locale.prototype, "hourCycle", {
395
392
  get: function () {
396
- return (0, get_internal_slots_1.default)(this).hourCycle;
393
+ return getInternalSlots(this).hourCycle;
397
394
  },
398
395
  enumerable: false,
399
396
  configurable: true
400
397
  });
401
398
  Object.defineProperty(Locale.prototype, "caseFirst", {
402
399
  get: function () {
403
- return (0, get_internal_slots_1.default)(this).caseFirst;
400
+ return getInternalSlots(this).caseFirst;
404
401
  },
405
402
  enumerable: false,
406
403
  configurable: true
407
404
  });
408
405
  Object.defineProperty(Locale.prototype, "numeric", {
409
406
  get: function () {
410
- return (0, get_internal_slots_1.default)(this).numeric;
407
+ return getInternalSlots(this).numeric;
411
408
  },
412
409
  enumerable: false,
413
410
  configurable: true
414
411
  });
415
412
  Object.defineProperty(Locale.prototype, "numberingSystem", {
416
413
  get: function () {
417
- return (0, get_internal_slots_1.default)(this).numberingSystem;
414
+ return getInternalSlots(this).numberingSystem;
418
415
  },
419
416
  enumerable: false,
420
417
  configurable: true
@@ -424,8 +421,8 @@ var Locale = /** @class */ (function () {
424
421
  * https://tc39.es/proposal-intl-locale/#sec-Intl.Locale.prototype.language
425
422
  */
426
423
  get: function () {
427
- var locale = (0, get_internal_slots_1.default)(this).locale;
428
- return (0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(locale).lang;
424
+ var locale = getInternalSlots(this).locale;
425
+ return parseUnicodeLanguageId(locale).lang;
429
426
  },
430
427
  enumerable: false,
431
428
  configurable: true
@@ -435,8 +432,8 @@ var Locale = /** @class */ (function () {
435
432
  * https://tc39.es/proposal-intl-locale/#sec-Intl.Locale.prototype.script
436
433
  */
437
434
  get: function () {
438
- var locale = (0, get_internal_slots_1.default)(this).locale;
439
- return (0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(locale).script;
435
+ var locale = getInternalSlots(this).locale;
436
+ return parseUnicodeLanguageId(locale).script;
440
437
  },
441
438
  enumerable: false,
442
439
  configurable: true
@@ -446,8 +443,8 @@ var Locale = /** @class */ (function () {
446
443
  * https://tc39.es/proposal-intl-locale/#sec-Intl.Locale.prototype.region
447
444
  */
448
445
  get: function () {
449
- var locale = (0, get_internal_slots_1.default)(this).locale;
450
- return (0, intl_getcanonicallocales_1.parseUnicodeLanguageId)(locale).region;
446
+ var locale = getInternalSlots(this).locale;
447
+ return parseUnicodeLanguageId(locale).region;
451
448
  },
452
449
  enumerable: false,
453
450
  configurable: true
@@ -491,7 +488,7 @@ var Locale = /** @class */ (function () {
491
488
  * https://tc39.es/proposal-intl-locale-info/#sec-Intl.Locale.prototype.getHourCycles
492
489
  */
493
490
  Locale.prototype.getHourCycles = function () {
494
- var locInternalSlots = (0, get_internal_slots_1.default)(this);
491
+ var locInternalSlots = getInternalSlots(this);
495
492
  if (locInternalSlots.initializedLocale === undefined) {
496
493
  throw new TypeError('Error uninitialized locale');
497
494
  }
@@ -548,7 +545,7 @@ var Locale = /** @class */ (function () {
548
545
  Locale.prototype.getTextInfo = function () {
549
546
  var info = Object.create(Object.prototype);
550
547
  var dir = characterDirectionOfLocale(this);
551
- (0, ecma402_abstract_1.defineProperty)(info, 'direction', {
548
+ defineProperty(info, 'direction', {
552
549
  value: dir,
553
550
  });
554
551
  return info;
@@ -582,19 +579,19 @@ var Locale = /** @class */ (function () {
582
579
  */
583
580
  Locale.prototype.getWeekInfo = function () {
584
581
  var info = Object.create(Object.prototype);
585
- var locInternalSlots = (0, get_internal_slots_1.default)(this);
582
+ var locInternalSlots = getInternalSlots(this);
586
583
  if (locInternalSlots.initializedLocale === undefined) {
587
584
  throw new TypeError('Error uninitialized locale');
588
585
  }
589
586
  var wi = weekInfoOfLocale(this);
590
587
  var we = wi.weekend;
591
- (0, ecma402_abstract_1.defineProperty)(info, 'firstDay', {
588
+ defineProperty(info, 'firstDay', {
592
589
  value: wi.firstDay,
593
590
  });
594
- (0, ecma402_abstract_1.defineProperty)(info, 'weekend', {
591
+ defineProperty(info, 'weekend', {
595
592
  value: we,
596
593
  });
597
- (0, ecma402_abstract_1.defineProperty)(info, 'minimalDays', {
594
+ defineProperty(info, 'minimalDays', {
598
595
  value: wi.minimalDays,
599
596
  });
600
597
  return info;
@@ -639,7 +636,7 @@ var Locale = /** @class */ (function () {
639
636
  Locale.polyfilled = true;
640
637
  return Locale;
641
638
  }());
642
- exports.Locale = Locale;
639
+ export { Locale };
643
640
  try {
644
641
  if (typeof Symbol !== 'undefined') {
645
642
  Object.defineProperty(Locale.prototype, Symbol.toStringTag, {
@@ -659,4 +656,4 @@ try {
659
656
  catch (e) {
660
657
  // Meta fix so we're test262-compliant, not important
661
658
  }
662
- exports.default = Locale;
659
+ export default Locale;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.numberingSystems = void 0;
4
1
  /* @generated */
5
2
  // prettier-ignore
6
- exports.numberingSystems = {
3
+ export var numberingSystems = {
7
4
  "aa": [
8
5
  "latn"
9
6
  ],
@@ -1,8 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var _1 = require("./");
1
+ import { Locale } from './';
4
2
  Object.defineProperty(Intl, 'Locale', {
5
- value: _1.Locale,
3
+ value: Locale,
6
4
  writable: true,
7
5
  enumerable: false,
8
6
  configurable: true,
package/lib/polyfill.js CHANGED
@@ -1,10 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var _1 = require("./");
4
- var should_polyfill_1 = require("./should-polyfill");
5
- if ((0, should_polyfill_1.shouldPolyfill)()) {
1
+ import { Locale } from './';
2
+ import { shouldPolyfill } from './should-polyfill';
3
+ if (shouldPolyfill()) {
6
4
  Object.defineProperty(Intl, 'Locale', {
7
- value: _1.Locale,
5
+ value: Locale,
8
6
  writable: true,
9
7
  enumerable: false,
10
8
  configurable: true,