mergeObject
mergeObject is a beast of a function which lets you smash two objects together and that options argument lets you control how exactly you want to merge things.Argument 1: Source Object --> What we are merging into (this is going to be mutated by default)
Argument 2: Mod Object --> What we are applying to the Source
insertKeys [true] -> If the Mod Object has keys in it which the Source does not have, add those keys to the Source object.insertValues [true] -> If the Source Object's values are objects themselves, this controls whether to merge those values as part of this operation (kind of discount recursive)So for your case:
Where
defaultValues is the setting's default, and the clientSettingsValues is the current setting value.This would take the baseline default value and overwrite any existing key/value, but not merge value objects (instead, it would replace them). It'll overwrite because the
overwrite option is true by default.