intl-messageformat 9.9.6 → 9.11.2

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.
@@ -477,8 +477,8 @@ function parseNumberSkeleton(tokens) {
477
477
 
478
478
  // bazel-out/darwin-fastbuild/bin/packages/icu-messageformat-parser/lib/parser.js
479
479
  var _a;
480
- var SPACE_SEPARATOR_START_REGEX = new RegExp("^" + SPACE_SEPARATOR_REGEX.source + "*");
481
- var SPACE_SEPARATOR_END_REGEX = new RegExp(SPACE_SEPARATOR_REGEX.source + "*$");
480
+ var SPACE_SEPARATOR_START_REGEX = new RegExp("^".concat(SPACE_SEPARATOR_REGEX.source, "*"));
481
+ var SPACE_SEPARATOR_END_REGEX = new RegExp("".concat(SPACE_SEPARATOR_REGEX.source, "*$"));
482
482
  function createLocation(start, end) {
483
483
  return { start, end };
484
484
  }
@@ -645,7 +645,7 @@ var Parser = function() {
645
645
  return {
646
646
  val: {
647
647
  type: TYPE.literal,
648
- value: "<" + tagName + "/>",
648
+ value: "<".concat(tagName, "/>"),
649
649
  location: createLocation(startPosition, this.clonePosition())
650
650
  },
651
651
  err: null
@@ -1035,7 +1035,7 @@ var Parser = function() {
1035
1035
  var _a2;
1036
1036
  var hasOtherClause = false;
1037
1037
  var options = [];
1038
- var parsedSelectors = new Set();
1038
+ var parsedSelectors = /* @__PURE__ */ new Set();
1039
1039
  var selector = parsedFirstIdentifier.value, selectorLocation = parsedFirstIdentifier.location;
1040
1040
  while (true) {
1041
1041
  if (selector.length === 0) {
@@ -1138,7 +1138,7 @@ var Parser = function() {
1138
1138
  }
1139
1139
  var code = codePointAt(this.message, offset);
1140
1140
  if (code === void 0) {
1141
- throw Error("Offset " + offset + " is at invalid UTF-16 code unit boundary");
1141
+ throw Error("Offset ".concat(offset, " is at invalid UTF-16 code unit boundary"));
1142
1142
  }
1143
1143
  return code;
1144
1144
  };
@@ -1188,7 +1188,7 @@ var Parser = function() {
1188
1188
  };
1189
1189
  Parser2.prototype.bumpTo = function(targetOffset) {
1190
1190
  if (this.offset() > targetOffset) {
1191
- throw Error("targetOffset " + targetOffset + " must be greater than or equal to the current offset " + this.offset());
1191
+ throw Error("targetOffset ".concat(targetOffset, " must be greater than or equal to the current offset ").concat(this.offset()));
1192
1192
  }
1193
1193
  targetOffset = Math.min(targetOffset, this.message.length);
1194
1194
  while (true) {
@@ -1197,7 +1197,7 @@ var Parser = function() {
1197
1197
  break;
1198
1198
  }
1199
1199
  if (offset > targetOffset) {
1200
- throw Error("targetOffset " + targetOffset + " is at invalid UTF-16 code unit boundary");
1200
+ throw Error("targetOffset ".concat(targetOffset, " is at invalid UTF-16 code unit boundary"));
1201
1201
  }
1202
1202
  this.bump();
1203
1203
  if (this.isEOF()) {
@@ -1322,7 +1322,7 @@ var serializerDefault = function() {
1322
1322
  return JSON.stringify(arguments);
1323
1323
  };
1324
1324
  function ObjectWithoutPrototypeCache() {
1325
- this.cache = Object.create(null);
1325
+ this.cache = /* @__PURE__ */ Object.create(null);
1326
1326
  }
1327
1327
  ObjectWithoutPrototypeCache.prototype.get = function(key) {
1328
1328
  return this.cache[key];
@@ -1,13 +1,31 @@
1
1
  var IntlMessageFormat = (function() {
2
2
  var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
3
6
  var __markAsModule = function(target) {
4
7
  return __defProp(target, "__esModule", { value: true });
5
8
  };
6
9
  var __export = function(target, all) {
7
- __markAsModule(target);
8
10
  for (var name in all)
9
11
  __defProp(target, name, { get: all[name], enumerable: true });
10
12
  };
13
+ var __reExport = function(target, module, copyDefault, desc) {
14
+ if (module && typeof module === "object" || typeof module === "function")
15
+ for (var keys = __getOwnPropNames(module), i = 0, n = keys.length, key; i < n; i++) {
16
+ key = keys[i];
17
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
18
+ __defProp(target, key, { get: function(k) {
19
+ return module[k];
20
+ }.bind(null, key), enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
21
+ }
22
+ return target;
23
+ };
24
+ var __toCommonJS = /* @__PURE__ */ function(cache) {
25
+ return function(module, temp) {
26
+ return cache && cache.get(module) || (temp = __reExport(__markAsModule({}), module, 1), cache && cache.set(module, temp), temp);
27
+ };
28
+ }(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
11
29
 
12
30
  // bazel-out/darwin-fastbuild/bin/packages/intl-messageformat/lib/index.js
13
31
  var lib_exports = {};
@@ -85,7 +103,7 @@ var IntlMessageFormat = (function() {
85
103
  ar[i] = from[i];
86
104
  }
87
105
  }
88
- return to.concat(ar || from);
106
+ return to.concat(ar || Array.prototype.slice.call(from));
89
107
  }
90
108
 
91
109
  // bazel-out/darwin-fastbuild/bin/packages/icu-messageformat-parser/lib/error.js
@@ -546,8 +564,8 @@ var IntlMessageFormat = (function() {
546
564
 
547
565
  // bazel-out/darwin-fastbuild/bin/packages/icu-messageformat-parser/lib/parser.js
548
566
  var _a;
549
- var SPACE_SEPARATOR_START_REGEX = new RegExp("^" + SPACE_SEPARATOR_REGEX.source + "*");
550
- var SPACE_SEPARATOR_END_REGEX = new RegExp(SPACE_SEPARATOR_REGEX.source + "*$");
567
+ var SPACE_SEPARATOR_START_REGEX = new RegExp("^".concat(SPACE_SEPARATOR_REGEX.source, "*"));
568
+ var SPACE_SEPARATOR_END_REGEX = new RegExp("".concat(SPACE_SEPARATOR_REGEX.source, "*$"));
551
569
  function createLocation(start, end) {
552
570
  return { start: start, end: end };
553
571
  }
@@ -714,7 +732,7 @@ var IntlMessageFormat = (function() {
714
732
  return {
715
733
  val: {
716
734
  type: TYPE.literal,
717
- value: "<" + tagName + "/>",
735
+ value: "<".concat(tagName, "/>"),
718
736
  location: createLocation(startPosition, this.clonePosition())
719
737
  },
720
738
  err: null
@@ -1104,7 +1122,7 @@ var IntlMessageFormat = (function() {
1104
1122
  var _a2;
1105
1123
  var hasOtherClause = false;
1106
1124
  var options = [];
1107
- var parsedSelectors = new Set();
1125
+ var parsedSelectors = /* @__PURE__ */ new Set();
1108
1126
  var selector = parsedFirstIdentifier.value, selectorLocation = parsedFirstIdentifier.location;
1109
1127
  while (true) {
1110
1128
  if (selector.length === 0) {
@@ -1207,7 +1225,7 @@ var IntlMessageFormat = (function() {
1207
1225
  }
1208
1226
  var code = codePointAt(this.message, offset);
1209
1227
  if (code === void 0) {
1210
- throw Error("Offset " + offset + " is at invalid UTF-16 code unit boundary");
1228
+ throw Error("Offset ".concat(offset, " is at invalid UTF-16 code unit boundary"));
1211
1229
  }
1212
1230
  return code;
1213
1231
  };
@@ -1257,7 +1275,7 @@ var IntlMessageFormat = (function() {
1257
1275
  };
1258
1276
  Parser2.prototype.bumpTo = function(targetOffset) {
1259
1277
  if (this.offset() > targetOffset) {
1260
- throw Error("targetOffset " + targetOffset + " must be greater than or equal to the current offset " + this.offset());
1278
+ throw Error("targetOffset ".concat(targetOffset, " must be greater than or equal to the current offset ").concat(this.offset()));
1261
1279
  }
1262
1280
  targetOffset = Math.min(targetOffset, this.message.length);
1263
1281
  while (true) {
@@ -1266,7 +1284,7 @@ var IntlMessageFormat = (function() {
1266
1284
  break;
1267
1285
  }
1268
1286
  if (offset > targetOffset) {
1269
- throw Error("targetOffset " + targetOffset + " is at invalid UTF-16 code unit boundary");
1287
+ throw Error("targetOffset ".concat(targetOffset, " is at invalid UTF-16 code unit boundary"));
1270
1288
  }
1271
1289
  this.bump();
1272
1290
  if (this.isEOF()) {
@@ -1391,7 +1409,7 @@ var IntlMessageFormat = (function() {
1391
1409
  return JSON.stringify(arguments);
1392
1410
  };
1393
1411
  function ObjectWithoutPrototypeCache() {
1394
- this.cache = Object.create(null);
1412
+ this.cache = /* @__PURE__ */ Object.create(null);
1395
1413
  }
1396
1414
  ObjectWithoutPrototypeCache.prototype.get = function(key) {
1397
1415
  return this.cache[key];
@@ -1425,28 +1443,28 @@ var IntlMessageFormat = (function() {
1425
1443
  return _this;
1426
1444
  }
1427
1445
  FormatError2.prototype.toString = function() {
1428
- return "[formatjs Error: " + this.code + "] " + this.message;
1446
+ return "[formatjs Error: ".concat(this.code, "] ").concat(this.message);
1429
1447
  };
1430
1448
  return FormatError2;
1431
1449
  }(Error);
1432
1450
  var InvalidValueError = function(_super) {
1433
1451
  __extends(InvalidValueError2, _super);
1434
1452
  function InvalidValueError2(variableId, value, options, originalMessage) {
1435
- return _super.call(this, 'Invalid values for "' + variableId + '": "' + value + '". Options are "' + Object.keys(options).join('", "') + '"', ErrorCode.INVALID_VALUE, originalMessage) || this;
1453
+ return _super.call(this, 'Invalid values for "'.concat(variableId, '": "').concat(value, '". Options are "').concat(Object.keys(options).join('", "'), '"'), ErrorCode.INVALID_VALUE, originalMessage) || this;
1436
1454
  }
1437
1455
  return InvalidValueError2;
1438
1456
  }(FormatError);
1439
1457
  var InvalidValueTypeError = function(_super) {
1440
1458
  __extends(InvalidValueTypeError2, _super);
1441
1459
  function InvalidValueTypeError2(value, type, originalMessage) {
1442
- return _super.call(this, 'Value for "' + value + '" must be of type ' + type, ErrorCode.INVALID_VALUE, originalMessage) || this;
1460
+ return _super.call(this, 'Value for "'.concat(value, '" must be of type ').concat(type), ErrorCode.INVALID_VALUE, originalMessage) || this;
1443
1461
  }
1444
1462
  return InvalidValueTypeError2;
1445
1463
  }(FormatError);
1446
1464
  var MissingValueError = function(_super) {
1447
1465
  __extends(MissingValueError2, _super);
1448
1466
  function MissingValueError2(variableId, originalMessage) {
1449
- return _super.call(this, 'The intl string context variable "' + variableId + '" was not provided to the string "' + originalMessage + '"', ErrorCode.MISSING_VALUE, originalMessage) || this;
1467
+ return _super.call(this, 'The intl string context variable "'.concat(variableId, '" was not provided to the string "').concat(originalMessage, '"'), ErrorCode.MISSING_VALUE, originalMessage) || this;
1450
1468
  }
1451
1469
  return MissingValueError2;
1452
1470
  }(FormatError);
@@ -1573,7 +1591,7 @@ var IntlMessageFormat = (function() {
1573
1591
  continue;
1574
1592
  }
1575
1593
  if (isPluralElement(el)) {
1576
- var opt = el.options["=" + value];
1594
+ var opt = el.options["=".concat(value)];
1577
1595
  if (!opt) {
1578
1596
  if (!Intl.PluralRules) {
1579
1597
  throw new FormatError('Intl.PluralRules is not available in this environment.\nTry polyfilling it using "@formatjs/intl-pluralrules"\n', ErrorCode.MISSING_INTL_API, originalMessage);
@@ -1802,7 +1820,7 @@ var IntlMessageFormat = (function() {
1802
1820
 
1803
1821
  // bazel-out/darwin-fastbuild/bin/packages/intl-messageformat/lib/index.js
1804
1822
  var lib_default = IntlMessageFormat;
1805
- return lib_exports;
1823
+ return __toCommonJS(lib_exports);
1806
1824
  })();
1807
1825
  /*! *****************************************************************************
1808
1826
  Copyright (c) Microsoft Corporation.
package/lib/src/error.js CHANGED
@@ -17,7 +17,7 @@ var FormatError = /** @class */ (function (_super) {
17
17
  return _this;
18
18
  }
19
19
  FormatError.prototype.toString = function () {
20
- return "[formatjs Error: " + this.code + "] " + this.message;
20
+ return "[formatjs Error: ".concat(this.code, "] ").concat(this.message);
21
21
  };
22
22
  return FormatError;
23
23
  }(Error));
@@ -25,7 +25,7 @@ export { FormatError };
25
25
  var InvalidValueError = /** @class */ (function (_super) {
26
26
  __extends(InvalidValueError, _super);
27
27
  function InvalidValueError(variableId, value, options, originalMessage) {
28
- return _super.call(this, "Invalid values for \"" + variableId + "\": \"" + value + "\". Options are \"" + Object.keys(options).join('", "') + "\"", ErrorCode.INVALID_VALUE, originalMessage) || this;
28
+ return _super.call(this, "Invalid values for \"".concat(variableId, "\": \"").concat(value, "\". Options are \"").concat(Object.keys(options).join('", "'), "\""), ErrorCode.INVALID_VALUE, originalMessage) || this;
29
29
  }
30
30
  return InvalidValueError;
31
31
  }(FormatError));
@@ -33,7 +33,7 @@ export { InvalidValueError };
33
33
  var InvalidValueTypeError = /** @class */ (function (_super) {
34
34
  __extends(InvalidValueTypeError, _super);
35
35
  function InvalidValueTypeError(value, type, originalMessage) {
36
- return _super.call(this, "Value for \"" + value + "\" must be of type " + type, ErrorCode.INVALID_VALUE, originalMessage) || this;
36
+ return _super.call(this, "Value for \"".concat(value, "\" must be of type ").concat(type), ErrorCode.INVALID_VALUE, originalMessage) || this;
37
37
  }
38
38
  return InvalidValueTypeError;
39
39
  }(FormatError));
@@ -41,7 +41,7 @@ export { InvalidValueTypeError };
41
41
  var MissingValueError = /** @class */ (function (_super) {
42
42
  __extends(MissingValueError, _super);
43
43
  function MissingValueError(variableId, originalMessage) {
44
- return _super.call(this, "The intl string context variable \"" + variableId + "\" was not provided to the string \"" + originalMessage + "\"", ErrorCode.MISSING_VALUE, originalMessage) || this;
44
+ return _super.call(this, "The intl string context variable \"".concat(variableId, "\" was not provided to the string \"").concat(originalMessage, "\""), ErrorCode.MISSING_VALUE, originalMessage) || this;
45
45
  }
46
46
  return MissingValueError;
47
47
  }(FormatError));
@@ -1,16 +1,17 @@
1
+ import { NumberFormatOptions } from '@formatjs/ecma402-abstract';
1
2
  import { MessageFormatElement } from '@formatjs/icu-messageformat-parser';
2
3
  export interface Formats {
3
- number: Record<string, Intl.NumberFormatOptions>;
4
+ number: Record<string, NumberFormatOptions>;
4
5
  date: Record<string, Intl.DateTimeFormatOptions>;
5
6
  time: Record<string, Intl.DateTimeFormatOptions>;
6
7
  }
7
8
  export interface FormatterCache {
8
- number: Record<string, Intl.NumberFormat>;
9
+ number: Record<string, NumberFormatOptions>;
9
10
  dateTime: Record<string, Intl.DateTimeFormat>;
10
11
  pluralRules: Record<string, Intl.PluralRules>;
11
12
  }
12
13
  export interface Formatters {
13
- getNumberFormat(...args: ConstructorParameters<typeof Intl.NumberFormat>): Intl.NumberFormat;
14
+ getNumberFormat(locals?: string | string[], opts?: NumberFormatOptions): Intl.NumberFormat;
14
15
  getDateTimeFormat(...args: ConstructorParameters<typeof Intl.DateTimeFormat>): Intl.DateTimeFormat;
15
16
  getPluralRules(...args: ConstructorParameters<typeof Intl.PluralRules>): Intl.PluralRules;
16
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../../../../../../packages/intl-messageformat/src/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,EAWL,oBAAoB,EAGrB,MAAM,oCAAoC,CAAA;AAS3C,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAA;IAChD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAA;IAChD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAA;CACjD;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;IACzC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,CAAC,CAAA;IAC7C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;CAC9C;AAED,MAAM,WAAW,UAAU;IACzB,eAAe,CACb,GAAG,IAAI,EAAE,qBAAqB,CAAC,OAAO,IAAI,CAAC,YAAY,CAAC,GACvD,IAAI,CAAC,YAAY,CAAA;IACpB,iBAAiB,CACf,GAAG,IAAI,EAAE,qBAAqB,CAAC,OAAO,IAAI,CAAC,cAAc,CAAC,GACzD,IAAI,CAAC,cAAc,CAAA;IACtB,cAAc,CACZ,GAAG,IAAI,EAAE,qBAAqB,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,GACtD,IAAI,CAAC,WAAW,CAAA;CACpB;AAED,oBAAY,SAAS;IACnB,OAAO,IAAA;IACP,MAAM,IAAA;CACP;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAC,OAAO,CAAA;IACvB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,GA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AAO,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAAA;AAuB/E,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,EAAE,EAAE,aAAa,GAAG,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAC5C,EAAE,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAE7B;AAGD,wBAAgB,aAAa,CAAC,CAAC,EAC7B,GAAG,EAAE,oBAAoB,EAAE,EAC3B,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,EAClE,kBAAkB,CAAC,EAAE,MAAM,EAE3B,eAAe,CAAC,EAAE,MAAM,GACvB,iBAAiB,CAAC,CAAC,CAAC,EAAE,CA6LxB;AAED,oBAAY,kBAAkB,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CACtE,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KACrB,CAAC,CAAA"}
@@ -156,7 +156,7 @@ originalMessage) {
156
156
  continue;
157
157
  }
158
158
  if (isPluralElement(el)) {
159
- var opt = el.options["=" + value];
159
+ var opt = el.options["=".concat(value)];
160
160
  if (!opt) {
161
161
  if (!Intl.PluralRules) {
162
162
  throw new FormatError("Intl.PluralRules is not available in this environment.\nTry polyfilling it using \"@formatjs/intl-pluralrules\"\n", ErrorCode.MISSING_INTL_API, originalMessage);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intl-messageformat",
3
- "version": "9.9.6",
3
+ "version": "9.11.2",
4
4
  "description": "Formats ICU Message strings with number, date, plural, and select placeholders to create localized messages.",
5
5
  "keywords": [
6
6
  "i18n",
@@ -31,8 +31,9 @@
31
31
  "module": "lib/index.js",
32
32
  "types": "index.d.ts",
33
33
  "dependencies": {
34
- "@formatjs/fast-memoize": "1.2.0",
35
- "@formatjs/icu-messageformat-parser": "2.0.14",
34
+ "@formatjs/ecma402-abstract": "1.11.1",
35
+ "@formatjs/fast-memoize": "1.2.1",
36
+ "@formatjs/icu-messageformat-parser": "2.0.16",
36
37
  "tslib": "^2.1.0"
37
38
  },
38
39
  "sideEffects": false,
package/src/error.js CHANGED
@@ -20,7 +20,7 @@ var FormatError = /** @class */ (function (_super) {
20
20
  return _this;
21
21
  }
22
22
  FormatError.prototype.toString = function () {
23
- return "[formatjs Error: " + this.code + "] " + this.message;
23
+ return "[formatjs Error: ".concat(this.code, "] ").concat(this.message);
24
24
  };
25
25
  return FormatError;
26
26
  }(Error));
@@ -28,7 +28,7 @@ exports.FormatError = FormatError;
28
28
  var InvalidValueError = /** @class */ (function (_super) {
29
29
  (0, tslib_1.__extends)(InvalidValueError, _super);
30
30
  function InvalidValueError(variableId, value, options, originalMessage) {
31
- return _super.call(this, "Invalid values for \"" + variableId + "\": \"" + value + "\". Options are \"" + Object.keys(options).join('", "') + "\"", ErrorCode.INVALID_VALUE, originalMessage) || this;
31
+ return _super.call(this, "Invalid values for \"".concat(variableId, "\": \"").concat(value, "\". Options are \"").concat(Object.keys(options).join('", "'), "\""), ErrorCode.INVALID_VALUE, originalMessage) || this;
32
32
  }
33
33
  return InvalidValueError;
34
34
  }(FormatError));
@@ -36,7 +36,7 @@ exports.InvalidValueError = InvalidValueError;
36
36
  var InvalidValueTypeError = /** @class */ (function (_super) {
37
37
  (0, tslib_1.__extends)(InvalidValueTypeError, _super);
38
38
  function InvalidValueTypeError(value, type, originalMessage) {
39
- return _super.call(this, "Value for \"" + value + "\" must be of type " + type, ErrorCode.INVALID_VALUE, originalMessage) || this;
39
+ return _super.call(this, "Value for \"".concat(value, "\" must be of type ").concat(type), ErrorCode.INVALID_VALUE, originalMessage) || this;
40
40
  }
41
41
  return InvalidValueTypeError;
42
42
  }(FormatError));
@@ -44,7 +44,7 @@ exports.InvalidValueTypeError = InvalidValueTypeError;
44
44
  var MissingValueError = /** @class */ (function (_super) {
45
45
  (0, tslib_1.__extends)(MissingValueError, _super);
46
46
  function MissingValueError(variableId, originalMessage) {
47
- return _super.call(this, "The intl string context variable \"" + variableId + "\" was not provided to the string \"" + originalMessage + "\"", ErrorCode.MISSING_VALUE, originalMessage) || this;
47
+ return _super.call(this, "The intl string context variable \"".concat(variableId, "\" was not provided to the string \"").concat(originalMessage, "\""), ErrorCode.MISSING_VALUE, originalMessage) || this;
48
48
  }
49
49
  return MissingValueError;
50
50
  }(FormatError));
@@ -1,16 +1,17 @@
1
+ import { NumberFormatOptions } from '@formatjs/ecma402-abstract';
1
2
  import { MessageFormatElement } from '@formatjs/icu-messageformat-parser';
2
3
  export interface Formats {
3
- number: Record<string, Intl.NumberFormatOptions>;
4
+ number: Record<string, NumberFormatOptions>;
4
5
  date: Record<string, Intl.DateTimeFormatOptions>;
5
6
  time: Record<string, Intl.DateTimeFormatOptions>;
6
7
  }
7
8
  export interface FormatterCache {
8
- number: Record<string, Intl.NumberFormat>;
9
+ number: Record<string, NumberFormatOptions>;
9
10
  dateTime: Record<string, Intl.DateTimeFormat>;
10
11
  pluralRules: Record<string, Intl.PluralRules>;
11
12
  }
12
13
  export interface Formatters {
13
- getNumberFormat(...args: ConstructorParameters<typeof Intl.NumberFormat>): Intl.NumberFormat;
14
+ getNumberFormat(locals?: string | string[], opts?: NumberFormatOptions): Intl.NumberFormat;
14
15
  getDateTimeFormat(...args: ConstructorParameters<typeof Intl.DateTimeFormat>): Intl.DateTimeFormat;
15
16
  getPluralRules(...args: ConstructorParameters<typeof Intl.PluralRules>): Intl.PluralRules;
16
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-messageformat/src/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,EAWL,oBAAoB,EAGrB,MAAM,oCAAoC,CA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AAI,kBAAkB,CAAC,CAAC,CAAC,CAE7B;AAGD,wBAAgB,aAAa,CAAC,CAAC,EAC7B,GAAG,EAAE,oBAAoB,EAAE,EAC3B,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,EAClE,kBAAkB,CAAC,EAAE,MAAM,EAE3B,eAAe,CAAC,EAAE,MAAM,GACvB,iBAAiB,CAAC,CAAC,CAAC,EAAE,CA6LxB;AAED,oBAAY,kBAAkB,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CACtE,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KACrB,CAAC,CAAA"}
package/src/formatters.js CHANGED
@@ -160,7 +160,7 @@ originalMessage) {
160
160
  continue;
161
161
  }
162
162
  if ((0, icu_messageformat_parser_1.isPluralElement)(el)) {
163
- var opt = el.options["=" + value];
163
+ var opt = el.options["=".concat(value)];
164
164
  if (!opt) {
165
165
  if (!Intl.PluralRules) {
166
166
  throw new error_1.FormatError("Intl.PluralRules is not available in this environment.\nTry polyfilling it using \"@formatjs/intl-pluralrules\"\n", error_1.ErrorCode.MISSING_INTL_API, originalMessage);