law-common 2.8.1-beta.24 → 2.8.1-beta.26

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.
@@ -1,4 +1,4 @@
1
- import { IApiEntity, IReimbursementEntity, ReimbursementActionEnum, ReimbursementExpenseActionEnum, ReimbursementExpenseState, ReimbursementStatusEnum } from "../../entities";
1
+ import { IApiEntity, IReimbursementEntity, IReimbursementExpenseEntity, ReimbursementActionEnum, ReimbursementExpenseActionEnum, ReimbursementExpenseState, ReimbursementStatusEnum } from "../../entities";
2
2
  import { IProjectEntityGet } from "./project.entity.response";
3
3
  import { IReimbursementExpenseApiEntityArray } from "./reimbursement_expense.api";
4
4
  import { IUserApiEntity } from "./user.entity.api";
@@ -34,7 +34,7 @@ export type IReimbursementFlowConfig = {
34
34
  };
35
35
  };
36
36
  export type IReimbursementFlowContextData = {
37
- expenseDetails: IReimbursementExpenseApiEntityArray;
37
+ expenseDetails: IReimbursementExpenseEntity[];
38
38
  };
39
39
  export type IReimbursementResponse = IReimbursementApiEntity & {
40
40
  expenseDetails: IReimbursementExpenseApiEntityArray;
@@ -6,6 +6,7 @@ export declare function convertMapToObject<K, T>(map: Map<K, T>): {
6
6
  };
7
7
  export declare function removeSamePropertyValues(source: any, target: any): void;
8
8
  export declare function getChangedProperties<T>(source: T, target: T): Partial<T>;
9
+ export declare function compareObjects<T extends Record<string, any>>(obj1: T, obj2: T): boolean;
9
10
  /**
10
11
  * Removes elements from the target array that are present in the source array.
11
12
  *
@@ -14,6 +14,7 @@ exports.groupByOneToOneFunction = groupByOneToOneFunction;
14
14
  exports.convertMapToObject = convertMapToObject;
15
15
  exports.removeSamePropertyValues = removeSamePropertyValues;
16
16
  exports.getChangedProperties = getChangedProperties;
17
+ exports.compareObjects = compareObjects;
17
18
  exports.removeElementsFromArray = removeElementsFromArray;
18
19
  exports.arrayDifference = arrayDifference;
19
20
  exports.arrayIntersection = arrayIntersection;
@@ -70,6 +71,24 @@ function getChangedProperties(source, target) {
70
71
  }
71
72
  return result;
72
73
  }
74
+ function compareObjects(obj1, obj2) {
75
+ if (!obj1 || !obj2) {
76
+ return obj1 === obj2;
77
+ }
78
+ const keys1 = Object.keys(obj1);
79
+ const keys2 = Object.keys(obj2);
80
+ if (keys1.length !== keys2.length) {
81
+ return false;
82
+ }
83
+ return keys1.every((key) => {
84
+ const val1 = obj1[key];
85
+ const val2 = obj2[key];
86
+ if (typeof val1 === "object" && typeof val2 === "object") {
87
+ return compareObjects(val1, val2);
88
+ }
89
+ return val1 === val2;
90
+ });
91
+ }
73
92
  /**
74
93
  * Removes elements from the target array that are present in the source array.
75
94
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "2.8.1-beta.24",
3
+ "version": "2.8.1-beta.26",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [