intl-messageformat 9.8.2 → 9.9.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/intl-messageformat.esm.js +36 -31
- package/intl-messageformat.iife.js +38 -29
- package/lib/src/core.d.ts.map +1 -1
- package/lib/src/core.js +0 -3
- package/package.json +3 -3
- package/src/core.d.ts.map +1 -1
- package/src/core.js +0 -3
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __require = typeof require !== "undefined" ? require : (x) => {
|
|
4
|
+
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
5
|
+
};
|
|
3
6
|
var __publicField = (obj, key, value) => {
|
|
4
7
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
8
|
return value;
|
|
@@ -231,7 +234,7 @@ function parseNumberSkeletonFromString(skeleton) {
|
|
|
231
234
|
throw new Error("Invalid number skeleton");
|
|
232
235
|
}
|
|
233
236
|
}
|
|
234
|
-
tokens.push({stem, options});
|
|
237
|
+
tokens.push({ stem, options });
|
|
235
238
|
}
|
|
236
239
|
return tokens;
|
|
237
240
|
}
|
|
@@ -239,11 +242,16 @@ function icuUnitToEcma(unit) {
|
|
|
239
242
|
return unit.replace(/^(.*?)-/, "");
|
|
240
243
|
}
|
|
241
244
|
var FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g;
|
|
242
|
-
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?$/g;
|
|
245
|
+
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g;
|
|
243
246
|
var INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g;
|
|
244
247
|
var CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;
|
|
245
248
|
function parseSignificantPrecision(str) {
|
|
246
249
|
var result = {};
|
|
250
|
+
if (str[str.length - 1] === "r") {
|
|
251
|
+
result.roundingPriority = "morePrecision";
|
|
252
|
+
} else if (str[str.length - 1] === "s") {
|
|
253
|
+
result.roundingPriority = "lessPrecision";
|
|
254
|
+
}
|
|
247
255
|
str.replace(SIGNIFICANT_PRECISION_REGEX, function(_, g1, g2) {
|
|
248
256
|
if (typeof g2 !== "string") {
|
|
249
257
|
result.minimumSignificantDigits = g1.length;
|
|
@@ -378,13 +386,13 @@ function parseNumberSkeleton(tokens) {
|
|
|
378
386
|
result.compactDisplay = "long";
|
|
379
387
|
continue;
|
|
380
388
|
case "scientific":
|
|
381
|
-
result = __assign(__assign(__assign({}, result), {notation: "scientific"}), token.options.reduce(function(all,
|
|
382
|
-
return __assign(__assign({}, all), parseNotationOptions(
|
|
389
|
+
result = __assign(__assign(__assign({}, result), { notation: "scientific" }), token.options.reduce(function(all, opt2) {
|
|
390
|
+
return __assign(__assign({}, all), parseNotationOptions(opt2));
|
|
383
391
|
}, {}));
|
|
384
392
|
continue;
|
|
385
393
|
case "engineering":
|
|
386
|
-
result = __assign(__assign(__assign({}, result), {notation: "engineering"}), token.options.reduce(function(all,
|
|
387
|
-
return __assign(__assign({}, all), parseNotationOptions(
|
|
394
|
+
result = __assign(__assign(__assign({}, result), { notation: "engineering" }), token.options.reduce(function(all, opt2) {
|
|
395
|
+
return __assign(__assign({}, all), parseNotationOptions(opt2));
|
|
388
396
|
}, {}));
|
|
389
397
|
continue;
|
|
390
398
|
case "notation-simple":
|
|
@@ -446,8 +454,11 @@ function parseNumberSkeleton(tokens) {
|
|
|
446
454
|
}
|
|
447
455
|
return "";
|
|
448
456
|
});
|
|
449
|
-
|
|
450
|
-
|
|
457
|
+
var opt = token.options[0];
|
|
458
|
+
if (opt === "w") {
|
|
459
|
+
result = __assign(__assign({}, result), { trailingZeroDisplay: "stripIfInteger" });
|
|
460
|
+
} else if (opt) {
|
|
461
|
+
result = __assign(__assign({}, result), parseSignificantPrecision(opt));
|
|
451
462
|
}
|
|
452
463
|
continue;
|
|
453
464
|
}
|
|
@@ -472,7 +483,7 @@ var _a;
|
|
|
472
483
|
var SPACE_SEPARATOR_START_REGEX = new RegExp("^" + SPACE_SEPARATOR_REGEX.source + "*");
|
|
473
484
|
var SPACE_SEPARATOR_END_REGEX = new RegExp(SPACE_SEPARATOR_REGEX.source + "*$");
|
|
474
485
|
function createLocation(start, end) {
|
|
475
|
-
return {start, end};
|
|
486
|
+
return { start, end };
|
|
476
487
|
}
|
|
477
488
|
var hasNativeStartsWith = !!String.prototype.startsWith;
|
|
478
489
|
var hasNativeFromCodePoint = !!String.fromCodePoint;
|
|
@@ -576,7 +587,7 @@ var Parser = function() {
|
|
|
576
587
|
options = {};
|
|
577
588
|
}
|
|
578
589
|
this.message = message;
|
|
579
|
-
this.position = {offset: 0, line: 1, column: 1};
|
|
590
|
+
this.position = { offset: 0, line: 1, column: 1 };
|
|
580
591
|
this.ignoreTag = !!options.ignoreTag;
|
|
581
592
|
this.requiresOtherClause = !!options.requiresOtherClause;
|
|
582
593
|
this.shouldParseSkeletons = !!options.shouldParseSkeletons;
|
|
@@ -626,7 +637,7 @@ var Parser = function() {
|
|
|
626
637
|
elements.push(result.val);
|
|
627
638
|
}
|
|
628
639
|
}
|
|
629
|
-
return {val: elements, err: null};
|
|
640
|
+
return { val: elements, err: null };
|
|
630
641
|
};
|
|
631
642
|
Parser2.prototype.parseTag = function(nestingLevel, parentArgType) {
|
|
632
643
|
var startPosition = this.clonePosition();
|
|
@@ -709,7 +720,7 @@ var Parser = function() {
|
|
|
709
720
|
}
|
|
710
721
|
var location = createLocation(start, this.clonePosition());
|
|
711
722
|
return {
|
|
712
|
-
val: {type: TYPE.literal, value, location},
|
|
723
|
+
val: { type: TYPE.literal, value, location },
|
|
713
724
|
err: null
|
|
714
725
|
};
|
|
715
726
|
};
|
|
@@ -825,7 +836,7 @@ var Parser = function() {
|
|
|
825
836
|
this.bumpTo(endOffset);
|
|
826
837
|
var endPosition = this.clonePosition();
|
|
827
838
|
var location = createLocation(startingPosition, endPosition);
|
|
828
|
-
return {value, location};
|
|
839
|
+
return { value, location };
|
|
829
840
|
};
|
|
830
841
|
Parser2.prototype.parseArgumentOptions = function(nestingLevel, expectingCloseTag, value, openingBracePosition) {
|
|
831
842
|
var _a2;
|
|
@@ -852,7 +863,7 @@ var Parser = function() {
|
|
|
852
863
|
return this.error(ErrorKind.EXPECT_ARGUMENT_STYLE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
853
864
|
}
|
|
854
865
|
var styleLocation = createLocation(styleStartPosition, this.clonePosition());
|
|
855
|
-
styleAndLocation = {style, styleLocation};
|
|
866
|
+
styleAndLocation = { style, styleLocation };
|
|
856
867
|
}
|
|
857
868
|
var argCloseResult = this.tryParseArgumentClose(openingBracePosition);
|
|
858
869
|
if (argCloseResult.err) {
|
|
@@ -867,7 +878,7 @@ var Parser = function() {
|
|
|
867
878
|
return result;
|
|
868
879
|
}
|
|
869
880
|
return {
|
|
870
|
-
val: {type: TYPE.number, value, location: location_1, style: result.val},
|
|
881
|
+
val: { type: TYPE.number, value, location: location_1, style: result.val },
|
|
871
882
|
err: null
|
|
872
883
|
};
|
|
873
884
|
} else {
|
|
@@ -882,7 +893,7 @@ var Parser = function() {
|
|
|
882
893
|
};
|
|
883
894
|
var type = argType === "date" ? TYPE.date : TYPE.time;
|
|
884
895
|
return {
|
|
885
|
-
val: {type, value, location: location_1, style},
|
|
896
|
+
val: { type, value, location: location_1, style },
|
|
886
897
|
err: null
|
|
887
898
|
};
|
|
888
899
|
}
|
|
@@ -963,7 +974,7 @@ var Parser = function() {
|
|
|
963
974
|
return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
964
975
|
}
|
|
965
976
|
this.bump();
|
|
966
|
-
return {val: true, err: null};
|
|
977
|
+
return { val: true, err: null };
|
|
967
978
|
};
|
|
968
979
|
Parser2.prototype.parseSimpleArgStyleIfPossible = function() {
|
|
969
980
|
var nestedBraces = 0;
|
|
@@ -1079,7 +1090,7 @@ var Parser = function() {
|
|
|
1079
1090
|
if (this.requiresOtherClause && !hasOtherClause) {
|
|
1080
1091
|
return this.error(ErrorKind.MISSING_OTHER_CLAUSE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
1081
1092
|
}
|
|
1082
|
-
return {val: options, err: null};
|
|
1093
|
+
return { val: options, err: null };
|
|
1083
1094
|
};
|
|
1084
1095
|
Parser2.prototype.tryParseDecimalInteger = function(expectNumberError, invalidNumberError) {
|
|
1085
1096
|
var sign = 1;
|
|
@@ -1108,7 +1119,7 @@ var Parser = function() {
|
|
|
1108
1119
|
if (!isSafeInteger(decimal)) {
|
|
1109
1120
|
return this.error(invalidNumberError, location);
|
|
1110
1121
|
}
|
|
1111
|
-
return {val: decimal, err: null};
|
|
1122
|
+
return { val: decimal, err: null };
|
|
1112
1123
|
};
|
|
1113
1124
|
Parser2.prototype.offset = function() {
|
|
1114
1125
|
return this.position.offset;
|
|
@@ -1251,7 +1262,7 @@ function parse(message, opts) {
|
|
|
1251
1262
|
if (opts === void 0) {
|
|
1252
1263
|
opts = {};
|
|
1253
1264
|
}
|
|
1254
|
-
opts = __assign({shouldParseSkeletons: true, requiresOtherClause: true}, opts);
|
|
1265
|
+
opts = __assign({ shouldParseSkeletons: true, requiresOtherClause: true }, opts);
|
|
1255
1266
|
var result = new Parser(message, opts).parse();
|
|
1256
1267
|
if (result.err) {
|
|
1257
1268
|
var error = SyntaxError(ErrorKind[result.err.kind]);
|
|
@@ -1316,9 +1327,6 @@ var serializerDefault = function() {
|
|
|
1316
1327
|
function ObjectWithoutPrototypeCache() {
|
|
1317
1328
|
this.cache = Object.create(null);
|
|
1318
1329
|
}
|
|
1319
|
-
ObjectWithoutPrototypeCache.prototype.has = function(key) {
|
|
1320
|
-
return key in this.cache;
|
|
1321
|
-
};
|
|
1322
1330
|
ObjectWithoutPrototypeCache.prototype.get = function(key) {
|
|
1323
1331
|
return this.cache[key];
|
|
1324
1332
|
};
|
|
@@ -1420,7 +1428,7 @@ function formatToParts(els, locales, formatters, formats, values, currentPluralV
|
|
|
1420
1428
|
}
|
|
1421
1429
|
continue;
|
|
1422
1430
|
}
|
|
1423
|
-
const {value: varName} = el;
|
|
1431
|
+
const { value: varName } = el;
|
|
1424
1432
|
if (!(values && varName in values)) {
|
|
1425
1433
|
throw new MissingValueError(varName, originalMessage);
|
|
1426
1434
|
}
|
|
@@ -1463,7 +1471,7 @@ function formatToParts(els, locales, formatters, formats, values, currentPluralV
|
|
|
1463
1471
|
continue;
|
|
1464
1472
|
}
|
|
1465
1473
|
if (isTagElement(el)) {
|
|
1466
|
-
const {children, value: value2} = el;
|
|
1474
|
+
const { children, value: value2 } = el;
|
|
1467
1475
|
const formatFn = values[value2];
|
|
1468
1476
|
if (!isFormatXMLElementFn(formatFn)) {
|
|
1469
1477
|
throw new InvalidValueTypeError(value2, "function", originalMessage);
|
|
@@ -1496,7 +1504,7 @@ function formatToParts(els, locales, formatters, formats, values, currentPluralV
|
|
|
1496
1504
|
Try polyfilling it using "@formatjs/intl-pluralrules"
|
|
1497
1505
|
`, ErrorCode.MISSING_INTL_API, originalMessage);
|
|
1498
1506
|
}
|
|
1499
|
-
const rule = formatters.getPluralRules(locales, {type: el.pluralType}).select(value - (el.offset || 0));
|
|
1507
|
+
const rule = formatters.getPluralRules(locales, { type: el.pluralType }).select(value - (el.offset || 0));
|
|
1500
1508
|
opt = el.options[rule] || el.options.other;
|
|
1501
1509
|
}
|
|
1502
1510
|
if (!opt) {
|
|
@@ -1533,15 +1541,12 @@ function mergeConfigs(defaultConfig, configs) {
|
|
|
1533
1541
|
return Object.keys(defaultConfig).reduce((all, k) => {
|
|
1534
1542
|
all[k] = mergeConfig(defaultConfig[k], configs[k]);
|
|
1535
1543
|
return all;
|
|
1536
|
-
}, {...defaultConfig});
|
|
1544
|
+
}, { ...defaultConfig });
|
|
1537
1545
|
}
|
|
1538
1546
|
function createFastMemoizeCache(store) {
|
|
1539
1547
|
return {
|
|
1540
1548
|
create() {
|
|
1541
1549
|
return {
|
|
1542
|
-
has(key) {
|
|
1543
|
-
return key in store;
|
|
1544
|
-
},
|
|
1545
1550
|
get(key) {
|
|
1546
1551
|
return store[key];
|
|
1547
1552
|
},
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
var IntlMessageFormat = (function() {
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __markAsModule = function(target) {
|
|
4
|
+
return __defProp(target, "__esModule", { value: true });
|
|
5
|
+
};
|
|
6
|
+
var __require = typeof require !== "undefined" ? require : function(x) {
|
|
7
|
+
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
+
};
|
|
3
9
|
var __export = function(target, all) {
|
|
10
|
+
__markAsModule(target);
|
|
4
11
|
for (var name in all)
|
|
5
|
-
__defProp(target, name, {get: all[name], enumerable: true});
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
13
|
};
|
|
7
14
|
|
|
8
15
|
// bazel-out/darwin-fastbuild/bin/packages/intl-messageformat/lib/index.js
|
|
@@ -42,7 +49,7 @@ var IntlMessageFormat = (function() {
|
|
|
42
49
|
|
|
43
50
|
// node_modules/tslib/tslib.es6.js
|
|
44
51
|
var extendStatics = function(d, b) {
|
|
45
|
-
extendStatics = Object.setPrototypeOf || {__proto__: []} instanceof Array && function(d2, b2) {
|
|
52
|
+
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
46
53
|
d2.__proto__ = b2;
|
|
47
54
|
} || function(d2, b2) {
|
|
48
55
|
for (var p in b2)
|
|
@@ -296,7 +303,7 @@ var IntlMessageFormat = (function() {
|
|
|
296
303
|
throw new Error("Invalid number skeleton");
|
|
297
304
|
}
|
|
298
305
|
}
|
|
299
|
-
tokens.push({stem: stem, options: options});
|
|
306
|
+
tokens.push({ stem: stem, options: options });
|
|
300
307
|
}
|
|
301
308
|
return tokens;
|
|
302
309
|
}
|
|
@@ -304,11 +311,16 @@ var IntlMessageFormat = (function() {
|
|
|
304
311
|
return unit.replace(/^(.*?)-/, "");
|
|
305
312
|
}
|
|
306
313
|
var FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g;
|
|
307
|
-
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?$/g;
|
|
314
|
+
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g;
|
|
308
315
|
var INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g;
|
|
309
316
|
var CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;
|
|
310
317
|
function parseSignificantPrecision(str) {
|
|
311
318
|
var result = {};
|
|
319
|
+
if (str[str.length - 1] === "r") {
|
|
320
|
+
result.roundingPriority = "morePrecision";
|
|
321
|
+
} else if (str[str.length - 1] === "s") {
|
|
322
|
+
result.roundingPriority = "lessPrecision";
|
|
323
|
+
}
|
|
312
324
|
str.replace(SIGNIFICANT_PRECISION_REGEX, function(_, g1, g2) {
|
|
313
325
|
if (typeof g2 !== "string") {
|
|
314
326
|
result.minimumSignificantDigits = g1.length;
|
|
@@ -443,13 +455,13 @@ var IntlMessageFormat = (function() {
|
|
|
443
455
|
result.compactDisplay = "long";
|
|
444
456
|
continue;
|
|
445
457
|
case "scientific":
|
|
446
|
-
result = __assign(__assign(__assign({}, result), {notation: "scientific"}), token.options.reduce(function(all,
|
|
447
|
-
return __assign(__assign({}, all), parseNotationOptions(
|
|
458
|
+
result = __assign(__assign(__assign({}, result), { notation: "scientific" }), token.options.reduce(function(all, opt2) {
|
|
459
|
+
return __assign(__assign({}, all), parseNotationOptions(opt2));
|
|
448
460
|
}, {}));
|
|
449
461
|
continue;
|
|
450
462
|
case "engineering":
|
|
451
|
-
result = __assign(__assign(__assign({}, result), {notation: "engineering"}), token.options.reduce(function(all,
|
|
452
|
-
return __assign(__assign({}, all), parseNotationOptions(
|
|
463
|
+
result = __assign(__assign(__assign({}, result), { notation: "engineering" }), token.options.reduce(function(all, opt2) {
|
|
464
|
+
return __assign(__assign({}, all), parseNotationOptions(opt2));
|
|
453
465
|
}, {}));
|
|
454
466
|
continue;
|
|
455
467
|
case "notation-simple":
|
|
@@ -511,8 +523,11 @@ var IntlMessageFormat = (function() {
|
|
|
511
523
|
}
|
|
512
524
|
return "";
|
|
513
525
|
});
|
|
514
|
-
|
|
515
|
-
|
|
526
|
+
var opt = token.options[0];
|
|
527
|
+
if (opt === "w") {
|
|
528
|
+
result = __assign(__assign({}, result), { trailingZeroDisplay: "stripIfInteger" });
|
|
529
|
+
} else if (opt) {
|
|
530
|
+
result = __assign(__assign({}, result), parseSignificantPrecision(opt));
|
|
516
531
|
}
|
|
517
532
|
continue;
|
|
518
533
|
}
|
|
@@ -537,7 +552,7 @@ var IntlMessageFormat = (function() {
|
|
|
537
552
|
var SPACE_SEPARATOR_START_REGEX = new RegExp("^" + SPACE_SEPARATOR_REGEX.source + "*");
|
|
538
553
|
var SPACE_SEPARATOR_END_REGEX = new RegExp(SPACE_SEPARATOR_REGEX.source + "*$");
|
|
539
554
|
function createLocation(start, end) {
|
|
540
|
-
return {start: start, end: end};
|
|
555
|
+
return { start: start, end: end };
|
|
541
556
|
}
|
|
542
557
|
var hasNativeStartsWith = !!String.prototype.startsWith;
|
|
543
558
|
var hasNativeFromCodePoint = !!String.fromCodePoint;
|
|
@@ -641,7 +656,7 @@ var IntlMessageFormat = (function() {
|
|
|
641
656
|
options = {};
|
|
642
657
|
}
|
|
643
658
|
this.message = message;
|
|
644
|
-
this.position = {offset: 0, line: 1, column: 1};
|
|
659
|
+
this.position = { offset: 0, line: 1, column: 1 };
|
|
645
660
|
this.ignoreTag = !!options.ignoreTag;
|
|
646
661
|
this.requiresOtherClause = !!options.requiresOtherClause;
|
|
647
662
|
this.shouldParseSkeletons = !!options.shouldParseSkeletons;
|
|
@@ -691,7 +706,7 @@ var IntlMessageFormat = (function() {
|
|
|
691
706
|
elements.push(result.val);
|
|
692
707
|
}
|
|
693
708
|
}
|
|
694
|
-
return {val: elements, err: null};
|
|
709
|
+
return { val: elements, err: null };
|
|
695
710
|
};
|
|
696
711
|
Parser2.prototype.parseTag = function(nestingLevel, parentArgType) {
|
|
697
712
|
var startPosition = this.clonePosition();
|
|
@@ -774,7 +789,7 @@ var IntlMessageFormat = (function() {
|
|
|
774
789
|
}
|
|
775
790
|
var location = createLocation(start, this.clonePosition());
|
|
776
791
|
return {
|
|
777
|
-
val: {type: TYPE.literal, value: value, location: location},
|
|
792
|
+
val: { type: TYPE.literal, value: value, location: location },
|
|
778
793
|
err: null
|
|
779
794
|
};
|
|
780
795
|
};
|
|
@@ -890,7 +905,7 @@ var IntlMessageFormat = (function() {
|
|
|
890
905
|
this.bumpTo(endOffset);
|
|
891
906
|
var endPosition = this.clonePosition();
|
|
892
907
|
var location = createLocation(startingPosition, endPosition);
|
|
893
|
-
return {value: value, location: location};
|
|
908
|
+
return { value: value, location: location };
|
|
894
909
|
};
|
|
895
910
|
Parser2.prototype.parseArgumentOptions = function(nestingLevel, expectingCloseTag, value, openingBracePosition) {
|
|
896
911
|
var _a2;
|
|
@@ -917,7 +932,7 @@ var IntlMessageFormat = (function() {
|
|
|
917
932
|
return this.error(ErrorKind.EXPECT_ARGUMENT_STYLE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
918
933
|
}
|
|
919
934
|
var styleLocation = createLocation(styleStartPosition, this.clonePosition());
|
|
920
|
-
styleAndLocation = {style: style, styleLocation: styleLocation};
|
|
935
|
+
styleAndLocation = { style: style, styleLocation: styleLocation };
|
|
921
936
|
}
|
|
922
937
|
var argCloseResult = this.tryParseArgumentClose(openingBracePosition);
|
|
923
938
|
if (argCloseResult.err) {
|
|
@@ -932,7 +947,7 @@ var IntlMessageFormat = (function() {
|
|
|
932
947
|
return result;
|
|
933
948
|
}
|
|
934
949
|
return {
|
|
935
|
-
val: {type: TYPE.number, value: value, location: location_1, style: result.val},
|
|
950
|
+
val: { type: TYPE.number, value: value, location: location_1, style: result.val },
|
|
936
951
|
err: null
|
|
937
952
|
};
|
|
938
953
|
} else {
|
|
@@ -947,7 +962,7 @@ var IntlMessageFormat = (function() {
|
|
|
947
962
|
};
|
|
948
963
|
var type = argType === "date" ? TYPE.date : TYPE.time;
|
|
949
964
|
return {
|
|
950
|
-
val: {type: type, value: value, location: location_1, style: style},
|
|
965
|
+
val: { type: type, value: value, location: location_1, style: style },
|
|
951
966
|
err: null
|
|
952
967
|
};
|
|
953
968
|
}
|
|
@@ -1028,7 +1043,7 @@ var IntlMessageFormat = (function() {
|
|
|
1028
1043
|
return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));
|
|
1029
1044
|
}
|
|
1030
1045
|
this.bump();
|
|
1031
|
-
return {val: true, err: null};
|
|
1046
|
+
return { val: true, err: null };
|
|
1032
1047
|
};
|
|
1033
1048
|
Parser2.prototype.parseSimpleArgStyleIfPossible = function() {
|
|
1034
1049
|
var nestedBraces = 0;
|
|
@@ -1144,7 +1159,7 @@ var IntlMessageFormat = (function() {
|
|
|
1144
1159
|
if (this.requiresOtherClause && !hasOtherClause) {
|
|
1145
1160
|
return this.error(ErrorKind.MISSING_OTHER_CLAUSE, createLocation(this.clonePosition(), this.clonePosition()));
|
|
1146
1161
|
}
|
|
1147
|
-
return {val: options, err: null};
|
|
1162
|
+
return { val: options, err: null };
|
|
1148
1163
|
};
|
|
1149
1164
|
Parser2.prototype.tryParseDecimalInteger = function(expectNumberError, invalidNumberError) {
|
|
1150
1165
|
var sign = 1;
|
|
@@ -1173,7 +1188,7 @@ var IntlMessageFormat = (function() {
|
|
|
1173
1188
|
if (!isSafeInteger(decimal)) {
|
|
1174
1189
|
return this.error(invalidNumberError, location);
|
|
1175
1190
|
}
|
|
1176
|
-
return {val: decimal, err: null};
|
|
1191
|
+
return { val: decimal, err: null };
|
|
1177
1192
|
};
|
|
1178
1193
|
Parser2.prototype.offset = function() {
|
|
1179
1194
|
return this.position.offset;
|
|
@@ -1316,7 +1331,7 @@ var IntlMessageFormat = (function() {
|
|
|
1316
1331
|
if (opts === void 0) {
|
|
1317
1332
|
opts = {};
|
|
1318
1333
|
}
|
|
1319
|
-
opts = __assign({shouldParseSkeletons: true, requiresOtherClause: true}, opts);
|
|
1334
|
+
opts = __assign({ shouldParseSkeletons: true, requiresOtherClause: true }, opts);
|
|
1320
1335
|
var result = new Parser(message, opts).parse();
|
|
1321
1336
|
if (result.err) {
|
|
1322
1337
|
var error = SyntaxError(ErrorKind[result.err.kind]);
|
|
@@ -1381,9 +1396,6 @@ var IntlMessageFormat = (function() {
|
|
|
1381
1396
|
function ObjectWithoutPrototypeCache() {
|
|
1382
1397
|
this.cache = Object.create(null);
|
|
1383
1398
|
}
|
|
1384
|
-
ObjectWithoutPrototypeCache.prototype.has = function(key) {
|
|
1385
|
-
return key in this.cache;
|
|
1386
|
-
};
|
|
1387
1399
|
ObjectWithoutPrototypeCache.prototype.get = function(key) {
|
|
1388
1400
|
return this.cache[key];
|
|
1389
1401
|
};
|
|
@@ -1569,7 +1581,7 @@ var IntlMessageFormat = (function() {
|
|
|
1569
1581
|
if (!Intl.PluralRules) {
|
|
1570
1582
|
throw new FormatError('Intl.PluralRules is not available in this environment.\nTry polyfilling it using "@formatjs/intl-pluralrules"\n', ErrorCode.MISSING_INTL_API, originalMessage);
|
|
1571
1583
|
}
|
|
1572
|
-
var rule = formatters.getPluralRules(locales, {type: el.pluralType}).select(value - (el.offset || 0));
|
|
1584
|
+
var rule = formatters.getPluralRules(locales, { type: el.pluralType }).select(value - (el.offset || 0));
|
|
1573
1585
|
opt = el.options[rule] || el.options.other;
|
|
1574
1586
|
}
|
|
1575
1587
|
if (!opt) {
|
|
@@ -1605,9 +1617,6 @@ var IntlMessageFormat = (function() {
|
|
|
1605
1617
|
return {
|
|
1606
1618
|
create: function() {
|
|
1607
1619
|
return {
|
|
1608
|
-
has: function(key) {
|
|
1609
|
-
return key in store;
|
|
1610
|
-
},
|
|
1611
1620
|
get: function(key) {
|
|
1612
1621
|
return store[key];
|
|
1613
1622
|
},
|
package/lib/src/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../../../../packages/intl-messageformat/src/core.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,KAAK,EAAE,oBAAoB,EAAC,MAAM,oCAAoC,CAAA;AAE9E,OAAO,EAEL,UAAU,EACV,OAAO,EAEP,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EAElB,MAAM,cAAc,CAAA;AAsCrB,MAAM,WAAW,OAAO;IACtB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../../../../packages/intl-messageformat/src/core.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,KAAK,EAAE,oBAAoB,EAAC,MAAM,oCAAoC,CAAA;AAE9E,OAAO,EAEL,UAAU,EACV,OAAO,EAEP,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EAElB,MAAM,cAAc,CAAA;AAsCrB,MAAM,WAAW,OAAO;IACtB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAwCD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAwB;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAC5C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAI9B;gBAEC,OAAO,EAAE,MAAM,GAAG,oBAAoB,EAAE,EACxC,OAAO,GAAE,MAAM,GAAG,MAAM,EAAoC,EAC5D,eAAe,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAClC,IAAI,CAAC,EAAE,OAAO;IAgChB,MAAM,yJAyBL;IACD,aAAa,6IAWV;IACH,eAAe;;MAEb;IACF,MAAM,+BAAiB;IACvB,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAsB;IAE1D,MAAM,KAAK,aAAa,WAOvB;IACD,MAAM,CAAC,OAAO,EAAE,OAAO,KAAK,GAAG,SAAS,CAAQ;IAIhD,MAAM,CAAC,OAAO,EAAE,OAAO,CAmEtB;CACF"}
|
package/lib/src/core.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intl-messageformat",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.9.3",
|
|
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,8 @@
|
|
|
31
31
|
"module": "lib/index.js",
|
|
32
32
|
"types": "index.d.ts",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@formatjs/fast-memoize": "1.
|
|
35
|
-
"@formatjs/icu-messageformat-parser": "2.0.
|
|
34
|
+
"@formatjs/fast-memoize": "1.2.0",
|
|
35
|
+
"@formatjs/icu-messageformat-parser": "2.0.13",
|
|
36
36
|
"tslib": "^2.1.0"
|
|
37
37
|
},
|
|
38
38
|
"sideEffects": false,
|
package/src/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-messageformat/src/core.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,KAAK,EAAE,oBAAoB,EAAC,MAAM,oCAAoC,CAAA;AAE9E,OAAO,EAEL,UAAU,EACV,OAAO,EAEP,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EAElB,MAAM,cAAc,CAAA;AAsCrB,MAAM,WAAW,OAAO;IACtB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../../../packages/intl-messageformat/src/core.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,KAAK,EAAE,oBAAoB,EAAC,MAAM,oCAAoC,CAAA;AAE9E,OAAO,EAEL,UAAU,EACV,OAAO,EAEP,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EAElB,MAAM,cAAc,CAAA;AAsCrB,MAAM,WAAW,OAAO;IACtB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAwCD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAwB;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAC5C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAI9B;gBAEC,OAAO,EAAE,MAAM,GAAG,oBAAoB,EAAE,EACxC,OAAO,GAAE,MAAM,GAAG,MAAM,EAAoC,EAC5D,eAAe,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,EAClC,IAAI,CAAC,EAAE,OAAO;IAgChB,MAAM,yJAyBL;IACD,aAAa,6IAWV;IACH,eAAe;;MAEb;IACF,MAAM,+BAAiB;IACvB,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAsB;IAE1D,MAAM,KAAK,aAAa,WAOvB;IACD,MAAM,CAAC,OAAO,EAAE,OAAO,KAAK,GAAG,SAAS,CAAQ;IAIhD,MAAM,CAAC,OAAO,EAAE,OAAO,CAmEtB;CACF"}
|