intl-messageformat 9.9.4 → 9.11.0

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
@@ -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()) {
@@ -546,8 +546,8 @@ var IntlMessageFormat = (function() {
546
546
 
547
547
  // bazel-out/darwin-fastbuild/bin/packages/icu-messageformat-parser/lib/parser.js
548
548
  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 + "*$");
549
+ var SPACE_SEPARATOR_START_REGEX = new RegExp("^".concat(SPACE_SEPARATOR_REGEX.source, "*"));
550
+ var SPACE_SEPARATOR_END_REGEX = new RegExp("".concat(SPACE_SEPARATOR_REGEX.source, "*$"));
551
551
  function createLocation(start, end) {
552
552
  return { start: start, end: end };
553
553
  }
@@ -714,7 +714,7 @@ var IntlMessageFormat = (function() {
714
714
  return {
715
715
  val: {
716
716
  type: TYPE.literal,
717
- value: "<" + tagName + "/>",
717
+ value: "<".concat(tagName, "/>"),
718
718
  location: createLocation(startPosition, this.clonePosition())
719
719
  },
720
720
  err: null
@@ -1207,7 +1207,7 @@ var IntlMessageFormat = (function() {
1207
1207
  }
1208
1208
  var code = codePointAt(this.message, offset);
1209
1209
  if (code === void 0) {
1210
- throw Error("Offset " + offset + " is at invalid UTF-16 code unit boundary");
1210
+ throw Error("Offset ".concat(offset, " is at invalid UTF-16 code unit boundary"));
1211
1211
  }
1212
1212
  return code;
1213
1213
  };
@@ -1257,7 +1257,7 @@ var IntlMessageFormat = (function() {
1257
1257
  };
1258
1258
  Parser2.prototype.bumpTo = function(targetOffset) {
1259
1259
  if (this.offset() > targetOffset) {
1260
- throw Error("targetOffset " + targetOffset + " must be greater than or equal to the current offset " + this.offset());
1260
+ throw Error("targetOffset ".concat(targetOffset, " must be greater than or equal to the current offset ").concat(this.offset()));
1261
1261
  }
1262
1262
  targetOffset = Math.min(targetOffset, this.message.length);
1263
1263
  while (true) {
@@ -1266,7 +1266,7 @@ var IntlMessageFormat = (function() {
1266
1266
  break;
1267
1267
  }
1268
1268
  if (offset > targetOffset) {
1269
- throw Error("targetOffset " + targetOffset + " is at invalid UTF-16 code unit boundary");
1269
+ throw Error("targetOffset ".concat(targetOffset, " is at invalid UTF-16 code unit boundary"));
1270
1270
  }
1271
1271
  this.bump();
1272
1272
  if (this.isEOF()) {
@@ -1425,28 +1425,28 @@ var IntlMessageFormat = (function() {
1425
1425
  return _this;
1426
1426
  }
1427
1427
  FormatError2.prototype.toString = function() {
1428
- return "[formatjs Error: " + this.code + "] " + this.message;
1428
+ return "[formatjs Error: ".concat(this.code, "] ").concat(this.message);
1429
1429
  };
1430
1430
  return FormatError2;
1431
1431
  }(Error);
1432
1432
  var InvalidValueError = function(_super) {
1433
1433
  __extends(InvalidValueError2, _super);
1434
1434
  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;
1435
+ return _super.call(this, 'Invalid values for "'.concat(variableId, '": "').concat(value, '". Options are "').concat(Object.keys(options).join('", "'), '"'), ErrorCode.INVALID_VALUE, originalMessage) || this;
1436
1436
  }
1437
1437
  return InvalidValueError2;
1438
1438
  }(FormatError);
1439
1439
  var InvalidValueTypeError = function(_super) {
1440
1440
  __extends(InvalidValueTypeError2, _super);
1441
1441
  function InvalidValueTypeError2(value, type, originalMessage) {
1442
- return _super.call(this, 'Value for "' + value + '" must be of type ' + type, ErrorCode.INVALID_VALUE, originalMessage) || this;
1442
+ return _super.call(this, 'Value for "'.concat(value, '" must be of type ').concat(type), ErrorCode.INVALID_VALUE, originalMessage) || this;
1443
1443
  }
1444
1444
  return InvalidValueTypeError2;
1445
1445
  }(FormatError);
1446
1446
  var MissingValueError = function(_super) {
1447
1447
  __extends(MissingValueError2, _super);
1448
1448
  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;
1449
+ 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
1450
  }
1451
1451
  return MissingValueError2;
1452
1452
  }(FormatError);
@@ -1573,7 +1573,7 @@ var IntlMessageFormat = (function() {
1573
1573
  continue;
1574
1574
  }
1575
1575
  if (isPluralElement(el)) {
1576
- var opt = el.options["=" + value];
1576
+ var opt = el.options["=".concat(value)];
1577
1577
  if (!opt) {
1578
1578
  if (!Intl.PluralRules) {
1579
1579
  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/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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CAAA;IACtB,KAAK,EAAE,CAAC,CAAA;CACT;AAED,oBAAY,iBAAiB,CAAC,CAAC,IAAI,WAAW,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;AAE9D,oBAAY,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,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.4",
3
+ "version": "9.11.0",
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.0",
35
+ "@formatjs/fast-memoize": "1.2.1",
36
+ "@formatjs/icu-messageformat-parser": "2.0.15",
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,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,C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AAG,OAAO,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"}
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);