@pronto-tools-and-more/custom-js-functions 14.51.0 → 14.55.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
@@ -412,6 +412,7 @@
412
412
  debugId: () => debugId,
413
413
  evaluateCondition: () => evaluateCondition,
414
414
  getLanguage: () => getLanguage,
415
+ getOptimizedImageSrc: () => getOptimizedImageSrc,
415
416
  getPrimaryCategoryProperty: () => getPrimaryCategoryProperty,
416
417
  getReadTime: () => getReadTime,
417
418
  handleMenuItems: () => handleMenuItems,
@@ -563,6 +564,22 @@
563
564
  return normalized;
564
565
  };
565
566
 
567
+ // src/parts/GetOptimizedImageSrc/GetOptimizedImageSrc.ts
568
+ var getOptimizedImageSrc = (src, webp, width) => {
569
+ let params = [];
570
+ if (webp) {
571
+ params.push("webp=1");
572
+ }
573
+ if (width) {
574
+ params.push(`w=${width}`);
575
+ }
576
+ const paramsString = params.join("&");
577
+ if (paramsString) {
578
+ return `${src}?${paramsString}`;
579
+ }
580
+ return src;
581
+ };
582
+
566
583
  // src/parts/HandleMenuItems/HandleMenuItems.ts
567
584
  var handleMenuItems = (items, active) => {
568
585
  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.51.0",
3
+ "version": "14.55.0",
4
4
  "description": "",
5
5
  "main": "dist/main.js",
6
6
  "type": "module",
package/src/main.ts CHANGED
@@ -1,3 +1,3 @@
1
- import * as Main from "./parts/Main/Main.js";
1
+ import * as Main from "./parts/Main/Main.ts";
2
2
 
3
3
  Main.main();
@@ -8,6 +8,7 @@ export * from "../FunctionId/FunctionId.ts";
8
8
  export * from "../FunctionIdOrUndefined/FunctionIdOrUndefined.ts";
9
9
  export * from "../GetCategoryProperty/GetCategoryProperty.ts";
10
10
  export * from "../GetLanguage/GetLanguage.ts";
11
+ export * from "../GetOptimizedImageSrc/GetOptimizedImageSrc.ts";
11
12
  export * from "../HandleMenuItems/HandleMenuItems.ts";
12
13
  export * from "../Parse/Parse.ts";
13
14
  export * from "../ReadTime/ReadTime.ts";
@@ -0,0 +1,18 @@
1
+ export const getOptimizedImageSrc = (
2
+ src: string,
3
+ webp?: boolean,
4
+ width?: number
5
+ ): string => {
6
+ let params: string[] = [];
7
+ if (webp) {
8
+ params.push("webp=1");
9
+ }
10
+ if (width) {
11
+ params.push(`w=${width}`);
12
+ }
13
+ const paramsString = params.join("&");
14
+ if (paramsString) {
15
+ return `${src}?${paramsString}`;
16
+ }
17
+ return src;
18
+ };
@@ -1,5 +1,5 @@
1
- import * as Functions from "../Functions/Functions.js";
2
- import * as Globals from "../Globals/Globals.js";
1
+ import * as Functions from "../Functions/Functions.ts";
2
+ import * as Globals from "../Globals/Globals.ts";
3
3
 
4
4
  export const main = () => {
5
5
  // @ts-ignore