sim-node-lib 0.3.27 → 0.3.28

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,7 +1,8 @@
1
1
  export declare class UpdateUtil {
2
2
  static updateObjectsWithSameType(mainObj: any, obj: any, type?: any): typeof type;
3
3
  }
4
- export declare function updateObjectsWithSameType(mainObj: any, obj: any, type?: any): typeof type;
4
+ export declare function overwriteSimilarObjectsProperties<T>(mainObj: any, obj: any): T;
5
+ export declare function mergeObjectsWithSameType<T>(mainObj: any, obj: any): T;
5
6
  export declare function flattenObjectIntoNewModel<T>(obj: any, model: {
6
7
  new (): any;
7
8
  $columnsDefinitions: {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.flattenObjectIntoNewModel = exports.updateObjectsWithSameType = exports.UpdateUtil = void 0;
3
+ exports.flattenObjectIntoNewModel = exports.mergeObjectsWithSameType = exports.overwriteSimilarObjectsProperties = exports.UpdateUtil = void 0;
4
4
  class UpdateUtil {
5
5
  static updateObjectsWithSameType(mainObj, obj, type) {
6
6
  for (let k of Object.keys(obj)) {
@@ -10,13 +10,21 @@ class UpdateUtil {
10
10
  }
11
11
  }
12
12
  exports.UpdateUtil = UpdateUtil;
13
- function updateObjectsWithSameType(mainObj, obj, type) {
13
+ function overwriteSimilarObjectsProperties(mainObj, obj) {
14
+ for (let k of Object.keys(obj)) {
15
+ if (mainObj[k])
16
+ mainObj[k] = obj[k];
17
+ }
18
+ return mainObj;
19
+ }
20
+ exports.overwriteSimilarObjectsProperties = overwriteSimilarObjectsProperties;
21
+ function mergeObjectsWithSameType(mainObj, obj) {
14
22
  for (let k of Object.keys(obj)) {
15
23
  mainObj[k] = obj[k];
16
24
  }
17
25
  return mainObj;
18
26
  }
19
- exports.updateObjectsWithSameType = updateObjectsWithSameType;
27
+ exports.mergeObjectsWithSameType = mergeObjectsWithSameType;
20
28
  function flattenObjectIntoNewModel(obj, model) {
21
29
  const flattenedObject = new model();
22
30
  for (let key of model.$columnsDefinitions.keys()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim-node-lib",
3
- "version": "0.3.27",
3
+ "version": "0.3.28",
4
4
  "description": "Library from SIMLabs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",