whitelabel-db 1.1.73 → 1.1.74

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.
@@ -68,7 +68,27 @@ let Hotel = class Hotel extends sequelize_typescript_1.Model {
68
68
  }, {});
69
69
  }
70
70
  // Helper function to get translated value or fallback
71
- const getNestedValue = (key) => { var _a; return (_a = translation[key]) !== null && _a !== void 0 ? _a : hotel[key]; };
71
+ const getNestedValue = (key) => {
72
+ try {
73
+ const translationValue = translation[key];
74
+ // Check if translation value is empty string, empty array, or empty object
75
+ if (!translationValue ||
76
+ translationValue === '' ||
77
+ (Array.isArray(translationValue) && translationValue.length === 0) ||
78
+ (typeof translationValue === 'object' &&
79
+ Object.keys(translationValue).length === 0)) {
80
+ // If it's empty, return the hotel object value
81
+ return hotel[key];
82
+ }
83
+ // Otherwise, return the translation value
84
+ return translationValue;
85
+ }
86
+ catch (error) {
87
+ // In case of an error, return the hotel value as a fallback
88
+ console.error(`Error getting translation for key "${key}":`, error);
89
+ return hotel[key];
90
+ }
91
+ };
72
92
  return Object.assign(hotel, {
73
93
  name: getNestedValue('name'),
74
94
  hotelDescription: getNestedValue('hotelDescription'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whitelabel-db",
3
- "version": "1.1.73",
3
+ "version": "1.1.74",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",