@pronto-tools-and-more/custom-js-functions 14.29.0 → 14.31.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
@@ -491,7 +491,7 @@
491
491
  var isCategory = (taxonomy) => {
492
492
  return taxonomy.type === "category";
493
493
  };
494
- var getPrimaryCategoryProperty = (content, key) => {
494
+ var getPrimaryCategoryProperty = (content, ...keys) => {
495
495
  try {
496
496
  if (!content) {
497
497
  return "n/a (no content)";
@@ -510,8 +510,11 @@
510
510
  if (!primaryCategory) {
511
511
  return "n/a";
512
512
  }
513
- const value = primaryCategory[key] || "n/a";
514
- return value;
513
+ let current = primaryCategory;
514
+ for (const key of keys) {
515
+ current = primaryCategory[key] || "n/a";
516
+ }
517
+ return current;
515
518
  } catch (error) {
516
519
  console.error(`Category Error: ${error}`);
517
520
  return `category error`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pronto-tools-and-more/custom-js-functions",
3
- "version": "14.29.0",
3
+ "version": "14.31.0",
4
4
  "description": "",
5
5
  "main": "dist/main.js",
6
6
  "type": "module",
@@ -2,7 +2,8 @@ const isCategory = (taxonomy) => {
2
2
  return taxonomy.type === "category";
3
3
  };
4
4
 
5
- export const getPrimaryCategoryProperty = (content, key) => {
5
+ export const getPrimaryCategoryProperty = (content, ...keys) => {
6
+ // TODO multiple keys
6
7
  try {
7
8
  if (!content) {
8
9
  return "n/a (no content)";
@@ -21,8 +22,11 @@ export const getPrimaryCategoryProperty = (content, key) => {
21
22
  if (!primaryCategory) {
22
23
  return "n/a";
23
24
  }
24
- const value = primaryCategory[key] || "n/a";
25
- return value;
25
+ let current = primaryCategory;
26
+ for (const key of keys) {
27
+ current = primaryCategory[key] || "n/a";
28
+ }
29
+ return current;
26
30
  } catch (error) {
27
31
  console.error(`Category Error: ${error}`);
28
32
  return `category error`;