@joai/core 1.0.1 → 1.0.2

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/dist/index.d.mts CHANGED
@@ -1192,7 +1192,7 @@ declare const sanitizeAlphanumeric: (val: string) => string;
1192
1192
  declare const sanitizeNumeric: (val: string) => string;
1193
1193
  declare const toNameInitials: (name?: string) => string;
1194
1194
  declare const toPreviewText: (text: string, maxChars?: number) => string;
1195
- declare const localize: (value: Partial<Record<string, string>> | null | undefined, locale?: string) => string;
1195
+ declare const localize: (value: Partial<Record<string, string>> | string | null | undefined, locale?: string) => string;
1196
1196
  //#endregion
1197
1197
  //#region src/helpers/number.d.ts
1198
1198
  declare const abbreviateNumber: (val: number) => string | number;
package/dist/index.mjs CHANGED
@@ -184,6 +184,7 @@ const toPreviewText = (text, maxChars = 100) => {
184
184
  };
185
185
  const localize = (value, locale) => {
186
186
  if (!value) return "";
187
+ if (typeof value === "string") return value;
187
188
  return value[locale ?? "en"] ?? value["en"] ?? Object.values(value)[0] ?? "";
188
189
  };
189
190
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/core",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "JoAi shared types, HTTP service, and config",
5
5
  "license": "MIT",
6
6
  "type": "module",