diff --git a/lib/utils.d.ts b/lib/utils.d.ts new file mode 100644 index 000000000..11d6c4213 --- /dev/null +++ b/lib/utils.d.ts @@ -0,0 +1,14 @@ +/** + * Merges two objects and removes null values if "shouldRemoveNullObjectValues" is set to true + * + * 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. + * On native, when merging an existing value with new changes, SQLite will use JSON_PATCH, which removes top-level nullish values. + * To be consistent with the behaviour for merge, we'll also want to remove null values for "set" operations. + */ +declare function fastMerge( + target: T, + source: T, + shouldRemoveNullObjectValues: boolean = true +): T; + +export default { fastMerge };