mergeRecursive = (obj1, obj2) => {
  if (obj1 && obj2 === undefined) {
    return obj1;
  }
  const mergedValue = {};
  forEach(obj1, (key, value) => {
    if (isMap(value)) {
      mergedValue[key] = mergeRecursive(value, obj2[key]);
    } else {
      mergedValue[key] = obj2[key] !== undefined ? obj2[key] : value;
    }
  });
  return mergedValue;
}
The function is used to recursively merge toolbar options.
It assumes all the options are peresent in obj1.
It recursively merges objects but not arrays.