intelica-library-components 1.1.67 → 1.1.68

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.
@@ -174,12 +174,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
174
174
  // import GlobalTermService from "../services/globalTerm.service";
175
175
  class TermPipe {
176
176
  globalTermService = inject(GlobalTermService);
177
- transform(termName, language, mode = 1) {
178
- let term = this.globalTermService.terms.find(x => x.termName == termName)?.termValue ?? "-";
179
- if (mode == 2)
180
- term = term.substring(0, 1);
181
- if (mode == 3)
182
- term = term.toUpperCase();
177
+ transform(termName, language = "es", mode = 1) {
178
+ const terms = this.globalTermService?.terms ?? [];
179
+ const safeTermName = (termName ?? "").trim();
180
+ if (!safeTermName)
181
+ return "-";
182
+ let term = terms.find((x) => x?.termName === safeTermName)?.termValue ?? "-";
183
+ if (typeof term !== "string")
184
+ term = String(term ?? "-");
185
+ if (mode === 2)
186
+ return term.length ? term.substring(0, 1) : "-";
187
+ if (mode === 3)
188
+ return term.toUpperCase();
183
189
  return term;
184
190
  }
185
191
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TermPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });