@payloadcms/translations 3.0.0-alpha.11 → 3.0.0-alpha.13

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.
@@ -157,7 +157,7 @@ const initTFunction = (args) => (key, vars) => {
157
157
  };
158
158
  function memoize(fn, keys) {
159
159
  const cacheMap = new Map();
160
- return function (args) {
160
+ const memoized = (args) => {
161
161
  const cacheKey = keys.reduce((acc, key) => acc + args[key], '');
162
162
  if (!cacheMap.has(cacheKey)) {
163
163
  const result = fn(args);
@@ -165,8 +165,9 @@ function memoize(fn, keys) {
165
165
  }
166
166
  return cacheMap.get(cacheKey);
167
167
  };
168
+ return memoized;
168
169
  }
169
- exports.initI18n = memoize((({ config, language = 'en', translations, context }) => {
170
+ exports.initI18n = memoize(({ config, language = 'en', translations, context }) => {
170
171
  const i18n = {
171
172
  fallbackLanguage: config.fallbackLanguage,
172
173
  language: language || config.fallbackLanguage,
@@ -177,4 +178,4 @@ exports.initI18n = memoize((({ config, language = 'en', translations, context })
177
178
  }),
178
179
  };
179
180
  return i18n;
180
- }), ['language', 'context']);
181
+ }, ['language', 'context']);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/translations",
3
- "version": "3.0.0-alpha.11",
3
+ "version": "3.0.0-alpha.13",
4
4
  "main": "./dist/exports/index.ts",
5
5
  "types": "./dist/types.d.ts",
6
6
  "publishConfig": {