@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
16 lines (14 loc) • 553 B
JavaScript
//#region src/providers/i18n-provider/i18n-cache.ts
const i18nCache = (Instance) => {
const formatterCache = /* @__PURE__ */ new Map();
return function create(locale, options) {
const key = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : "");
if (formatterCache.has(key)) return formatterCache.get(key);
const formatter = new Instance(locale, options);
formatterCache.set(key, formatter);
return formatter;
};
};
//#endregion
exports.i18nCache = i18nCache;
//# sourceMappingURL=i18n-cache.cjs.map