62 lines
2.1 KiB
JavaScript
62 lines
2.1 KiB
JavaScript
// Metro module 1277 (f1278).
|
|
import * as _classCallCheck from "./_classCallCheck";
|
|
import * as __createClass from "./_createClass";
|
|
let env1039 = {};
|
|
const FormatterCache = function FormatterCache() {
|
|
_classCallCheck(this, FormatterCache);
|
|
this.dateTime = new Map();
|
|
this.duration = new Map();
|
|
this.list = new Map();
|
|
this.number = new Map();
|
|
this.pluralRules = new Map();
|
|
this.relativeTime = new Map();
|
|
};
|
|
export const dataFormatterCache = new (__createClass(FormatterCache, [{
|
|
key: "getDateTimeFormatter",
|
|
value: function getDateTimeFormatter() {
|
|
return this._getCached(this.dateTime, Array.prototype.slice.call(arguments, 0), (a0) => new Intl.DateTimeFormat(...[...a0]));
|
|
}
|
|
}, {
|
|
key: "getDurationFormatter",
|
|
value: function getDurationFormatter() {
|
|
return this._getCached(this.duration, Array.prototype.slice.call(arguments, 0), (a0) => new Intl.DurationFormat(...[...a0]));
|
|
}
|
|
}, {
|
|
key: "getListFormatter",
|
|
value: function getListFormatter() {
|
|
return this._getCached(this.list, Array.prototype.slice.call(arguments, 0), (a0) => new Intl.ListFormat(...[...a0]));
|
|
}
|
|
}, {
|
|
key: "getNumberFormatter",
|
|
value: function getNumberFormatter() {
|
|
return this._getCached(this.number, Array.prototype.slice.call(arguments, 0), (a0) => new Intl.NumberFormat(...[...a0]));
|
|
}
|
|
}, {
|
|
key: "getPluralRules",
|
|
value: function getPluralRules() {
|
|
return this._getCached(this.pluralRules, Array.prototype.slice.call(arguments, 0), (a0) => new Intl.PluralRules(...[...a0]));
|
|
}
|
|
}, {
|
|
key: "getRelativeTimeFormatter",
|
|
value: function getRelativeTimeFormatter() {
|
|
return this._getCached(this.relativeTime, Array.prototype.slice.call(arguments, 0), (a0) => new Intl.RelativeTimeFormat(...[...a0]));
|
|
}
|
|
}, {
|
|
key: "_getCached",
|
|
value: function _getCached(a0, a1, a2) {
|
|
const r4 = this._getKey(a1);
|
|
const r7 = a0.get(r4);
|
|
if (r7) {
|
|
return r7;
|
|
}
|
|
const r9 = a2(a1);
|
|
a0.set(r4, r9);
|
|
return r9;
|
|
}
|
|
}, {
|
|
key: "_getKey",
|
|
value: function _getKey() {
|
|
return JSON.stringify(Array.prototype.slice.call(arguments, 0));
|
|
}
|
|
}]))();
|