@pronto-tools-and-more/custom-js-functions 14.62.0 → 14.64.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
@@ -415,6 +415,7 @@
415
415
  getOptimizedImageSrc: () => getOptimizedImageSrc,
416
416
  getPrimaryCategoryProperty: () => getPrimaryCategoryProperty,
417
417
  getReadTime: () => getReadTime,
418
+ getSearchResultCount: () => getSearchResultCount,
418
419
  handleMenuItems: () => handleMenuItems,
419
420
  id: () => id,
420
421
  idOrUndefined: () => idOrUndefined,
@@ -580,6 +581,20 @@
580
581
  return src;
581
582
  };
582
583
 
584
+ // src/parts/GetSearchResultCount/GetSearchResultCount.ts
585
+ var getSearchResultCount = (searchResults) => {
586
+ if (!searchResults) {
587
+ return "";
588
+ }
589
+ if (searchResults.totalCount !== void 0) {
590
+ return `${searchResults.totalCount}`;
591
+ }
592
+ if (searchResults.length !== void 0) {
593
+ return `${searchResults.length}`;
594
+ }
595
+ return "";
596
+ };
597
+
583
598
  // src/parts/HandleMenuItems/HandleMenuItems.ts
584
599
  var handleMenuItems = (items, active) => {
585
600
  const index = items.findIndex((item) => item.id === active);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pronto-tools-and-more/custom-js-functions",
3
- "version": "14.62.0",
3
+ "version": "14.64.0",
4
4
  "description": "",
5
5
  "main": "dist/main.js",
6
6
  "type": "module",
@@ -9,6 +9,7 @@ export * from "../FunctionIdOrUndefined/FunctionIdOrUndefined.ts";
9
9
  export * from "../GetCategoryProperty/GetCategoryProperty.ts";
10
10
  export * from "../GetLanguage/GetLanguage.ts";
11
11
  export * from "../GetOptimizedImageSrc/GetOptimizedImageSrc.ts";
12
+ export * from "../GetSearchResultCount/GetSearchResultCount.ts";
12
13
  export * from "../HandleMenuItems/HandleMenuItems.ts";
13
14
  export * from "../Parse/Parse.ts";
14
15
  export * from "../ReadTime/ReadTime.ts";
@@ -0,0 +1,12 @@
1
+ export const getSearchResultCount = (searchResults: any): string => {
2
+ if (!searchResults) {
3
+ return "";
4
+ }
5
+ if (searchResults.totalCount !== undefined) {
6
+ return `${searchResults.totalCount}`;
7
+ }
8
+ if (searchResults.length !== undefined) {
9
+ return `${searchResults.length}`;
10
+ }
11
+ return "";
12
+ };