@pronto-tools-and-more/custom-js-functions 14.31.0 → 14.33.0

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/main.js CHANGED
@@ -512,7 +512,7 @@
512
512
  }
513
513
  let current = primaryCategory;
514
514
  for (const key of keys) {
515
- current = primaryCategory[key] || "n/a";
515
+ current = current[key] || "n/a";
516
516
  }
517
517
  return current;
518
518
  } catch (error) {
@@ -525,18 +525,30 @@
525
525
  var normalizeLanguage = (language) => {
526
526
  switch (language) {
527
527
  case "de-de":
528
+ case "de-DE":
529
+ case "de_DE":
528
530
  return "de";
529
531
  case "fr-fr":
532
+ case "fr-FR":
533
+ case "fr_FR":
530
534
  return "fr";
531
535
  case "it-it":
536
+ case "it-IT":
537
+ case "it_IT":
532
538
  return "it";
533
539
  case "es-es":
540
+ case "es-ES":
541
+ case "es_ES":
534
542
  return "es";
535
543
  default:
536
544
  return language;
537
545
  }
538
546
  };
539
547
  var getLanguage = (content) => {
548
+ console.log({ content });
549
+ if (typeof content === "string") {
550
+ return normalizeLanguage(content);
551
+ }
540
552
  if (!content) {
541
553
  return "n/a (no content)";
542
554
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pronto-tools-and-more/custom-js-functions",
3
- "version": "14.31.0",
3
+ "version": "14.33.0",
4
4
  "description": "",
5
5
  "main": "dist/main.js",
6
6
  "type": "module",
@@ -24,7 +24,7 @@ export const getPrimaryCategoryProperty = (content, ...keys) => {
24
24
  }
25
25
  let current = primaryCategory;
26
26
  for (const key of keys) {
27
- current = primaryCategory[key] || "n/a";
27
+ current = current[key] || "n/a";
28
28
  }
29
29
  return current;
30
30
  } catch (error) {
@@ -1,12 +1,20 @@
1
1
  const normalizeLanguage = (language) => {
2
2
  switch (language) {
3
3
  case "de-de":
4
+ case "de-DE":
5
+ case "de_DE":
4
6
  return "de";
5
7
  case "fr-fr":
8
+ case "fr-FR":
9
+ case "fr_FR":
6
10
  return "fr";
7
11
  case "it-it":
12
+ case "it-IT":
13
+ case "it_IT":
8
14
  return "it";
9
15
  case "es-es":
16
+ case "es-ES":
17
+ case "es_ES":
10
18
  return "es";
11
19
  default:
12
20
  return language;
@@ -14,6 +22,10 @@ const normalizeLanguage = (language) => {
14
22
  };
15
23
 
16
24
  export const getLanguage = (content) => {
25
+ console.log({ content });
26
+ if (typeof content === "string") {
27
+ return normalizeLanguage(content);
28
+ }
17
29
  if (!content) {
18
30
  return "n/a (no content)";
19
31
  }