react-native-onyx 1.0.108 → 1.0.109
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/lib/utils.d.ts +14 -0
- package/package.json +1 -1
package/lib/utils.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merges two objects and removes null values if "shouldRemoveNullObjectValues" is set to true
|
|
3
|
+
*
|
|
4
|
+
* We generally want to remove null values from objects written to disk and cache, because it decreases the amount of data stored in memory and on disk.
|
|
5
|
+
* On native, when merging an existing value with new changes, SQLite will use JSON_PATCH, which removes top-level nullish values.
|
|
6
|
+
* To be consistent with the behaviour for merge, we'll also want to remove null values for "set" operations.
|
|
7
|
+
*/
|
|
8
|
+
declare function fastMerge<T>(
|
|
9
|
+
target: T,
|
|
10
|
+
source: T,
|
|
11
|
+
shouldRemoveNullObjectValues: boolean = true
|
|
12
|
+
): T;
|
|
13
|
+
|
|
14
|
+
export default { fastMerge };
|