@pronto-tools-and-more/custom-js-functions 10.34.0 → 10.35.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/main.js CHANGED
@@ -406,7 +406,9 @@
406
406
  var Functions_exports = {};
407
407
  __export(Functions_exports, {
408
408
  dateHelper: () => dateHelper,
409
+ debugId: () => debugId,
409
410
  getReadTime: () => getReadTime,
411
+ handleMenuItems: () => handleMenuItems,
410
412
  id: () => id
411
413
  });
412
414
 
@@ -419,17 +421,34 @@
419
421
  var import_it = __toESM(require_it(), 1);
420
422
  var dateHelper = import_dayjs.default;
421
423
 
424
+ // src/parts/FunctionDebugId/FunctionDebugId.ts
425
+ var debugId = (content, ...keys) => {
426
+ let current = content;
427
+ for (const key of keys) {
428
+ console.log({ content, key });
429
+ current = current?.[key];
430
+ }
431
+ return current;
432
+ };
433
+
422
434
  // src/parts/FunctionId/FunctionId.ts
423
435
  var id = (content, ...keys) => {
424
- console.log({ content });
425
436
  let current = content;
426
437
  for (const key of keys) {
427
- console.log({ current, key });
428
438
  current = current?.[key];
429
439
  }
430
440
  return current;
431
441
  };
432
442
 
443
+ // src/parts/HandleMenuItems/HandleMenuItems.ts
444
+ var handleMenuItems = (items, active) => {
445
+ const index = items.findIndex((item) => item.id === active);
446
+ if (index === -1) {
447
+ return "";
448
+ }
449
+ return `highlight-${index}`;
450
+ };
451
+
433
452
  // src/parts/ReadTime/ReadTime.ts
434
453
  var getReadTime = (content) => {
435
454
  const parsedSeo = JSON.parse(content?.properties?.purple_seo_meta);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pronto-tools-and-more/custom-js-functions",
3
- "version": "10.34.0",
3
+ "version": "10.35.0",
4
4
  "description": "",
5
5
  "main": "dist/main.js",
6
6
  "type": "module",
@@ -0,0 +1,8 @@
1
+ export const debugId = (content, ...keys) => {
2
+ let current = content;
3
+ for (const key of keys) {
4
+ console.log({ content, key });
5
+ current = current?.[key];
6
+ }
7
+ return current;
8
+ };
@@ -1,8 +1,6 @@
1
1
  export const id = (content, ...keys) => {
2
- console.log({ content });
3
2
  let current = content;
4
3
  for (const key of keys) {
5
- console.log({ current, key });
6
4
  current = current?.[key];
7
5
  }
8
6
  return current;
@@ -1,3 +1,5 @@
1
1
  export * from "../DateHelper/DateHelper.ts";
2
- export * from "../FunctionId/FunctionId.js";
2
+ export * from "../FunctionDebugId/FunctionDebugId.ts";
3
+ export * from "../FunctionId/FunctionId.ts";
4
+ export * from "../HandleMenuItems/HandleMenuItems.ts";
3
5
  export * from "../ReadTime/ReadTime.ts";
@@ -0,0 +1,7 @@
1
+ export const handleMenuItems = (items, active) => {
2
+ const index = items.findIndex((item) => item.id === active);
3
+ if (index === -1) {
4
+ return "";
5
+ }
6
+ return `highlight-${index}`;
7
+ };