react-native-onyx 2.0.116 → 2.0.117
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/utils.js +22 -4
- package/package.json +1 -1
package/dist/utils.js
CHANGED
|
@@ -90,11 +90,29 @@ function fastMerge(target, source, shouldRemoveNestedNulls = true) {
|
|
|
90
90
|
}
|
|
91
91
|
/** Deep removes the nested null values from the given value. */
|
|
92
92
|
function removeNestedNullValues(value) {
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
return fastMerge(objectValue, objectValue);
|
|
93
|
+
if (value === null || value === undefined) {
|
|
94
|
+
return value;
|
|
96
95
|
}
|
|
97
|
-
|
|
96
|
+
if (typeof value !== 'object' || Array.isArray(value)) {
|
|
97
|
+
return value;
|
|
98
|
+
}
|
|
99
|
+
const result = {};
|
|
100
|
+
// eslint-disable-next-line no-restricted-syntax, guard-for-in
|
|
101
|
+
for (const key in value) {
|
|
102
|
+
const propertyValue = value[key];
|
|
103
|
+
if (propertyValue === null || propertyValue === undefined) {
|
|
104
|
+
// eslint-disable-next-line no-continue
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (typeof propertyValue === 'object' && !Array.isArray(propertyValue)) {
|
|
108
|
+
const valueWithoutNestedNulls = removeNestedNullValues(propertyValue);
|
|
109
|
+
result[key] = valueWithoutNestedNulls;
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
result[key] = propertyValue;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return result;
|
|
98
116
|
}
|
|
99
117
|
/** Formats the action name by uppercasing and adding the key if provided. */
|
|
100
118
|
function formatActionName(method, key) {
|