@pronto-tools-and-more/custom-js-functions 12.48.0 → 12.50.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
@@ -407,6 +407,7 @@
407
407
  __export(Functions_exports, {
408
408
  assign: () => assign,
409
409
  bookmarkIdString: () => bookmarkIdString,
410
+ checkLength: () => checkLength,
410
411
  dateHelper: () => dateHelper,
411
412
  debugId: () => debugId,
412
413
  getPrimaryCategoryProperty: () => getPrimaryCategoryProperty,
@@ -423,6 +424,15 @@
423
424
  return `$context.${key}`;
424
425
  };
425
426
 
427
+ // src/parts/CheckLength/CheckLength.ts
428
+ var checkLength = (expression) => {
429
+ const available = expression && expression.length > 0;
430
+ if (available) {
431
+ return "yes";
432
+ }
433
+ return "no";
434
+ };
435
+
426
436
  // src/parts/DateHelper/DateHelper.ts
427
437
  var import_dayjs = __toESM(require_dayjs_min(), 1);
428
438
  var import_de = __toESM(require_de(), 1);
@@ -499,7 +509,7 @@
499
509
  var getReadTime = (content) => {
500
510
  const parsedSeo = JSON.parse(content?.properties?.purple_seo_meta);
501
511
  const readTimeNumber = parsedSeo?.est_reading_time_minutes;
502
- if (readTimeNumber) {
512
+ if (typeof readTimeNumber === "number") {
503
513
  return `${readTimeNumber} min`;
504
514
  }
505
515
  const readTime = parsedSeo?.twitter_misc?.["Est. reading time"] || "n/a";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pronto-tools-and-more/custom-js-functions",
3
- "version": "12.48.0",
3
+ "version": "12.50.0",
4
4
  "description": "",
5
5
  "main": "dist/main.js",
6
6
  "type": "module",
@@ -0,0 +1,8 @@
1
+ export const checkLength = (expression: any) => {
2
+ const available = expression && expression.length > 0;
3
+ // cannot use booleans for some reason...
4
+ if (available) {
5
+ return "yes";
6
+ }
7
+ return "no";
8
+ };
@@ -1,4 +1,5 @@
1
1
  export * from "../Assign/Assign.ts";
2
+ export * from "../CheckLength/CheckLength.ts";
2
3
  export * from "../DateHelper/DateHelper.ts";
3
4
  export * from "../FunctionBookmarkIdString/FunctionBookmarkIdString.ts";
4
5
  export * from "../FunctionDebugId/FunctionDebugId.ts";
@@ -1,7 +1,7 @@
1
1
  export const getReadTime = (content: any) => {
2
2
  const parsedSeo = JSON.parse(content?.properties?.purple_seo_meta);
3
3
  const readTimeNumber = parsedSeo?.est_reading_time_minutes;
4
- if (readTimeNumber) {
4
+ if (typeof readTimeNumber === "number") {
5
5
  return `${readTimeNumber} min`;
6
6
  }
7
7
  const readTime = parsedSeo?.twitter_misc?.["Est. reading time"] || "n/a";