function setNestedKey(obj, keyPath, value) {
  // Ex. foo.bar.zoop will extract foo and bar.zoop
  const match = keyPath.match(/([a-z_]+)\.(.*)/i);
  // The match will be null when there's no more recursing to do, i.e., when we've reached the right level of the object
  if (match === null) {
    obj[keyPath] = value;
  } else {
    // `match[1]` is the initial segment of the path, and `match[2]` is the remainder of the path
    const innerObj = obj[match[1]];
    setNestedKey(innerObj, match[2], value);
  }
}
Recursively traverses an object to update an existing nested key.
Note: The provided key path must include existing properties,
the function will not create objects while traversing.

@param obj An object to update
@param value The value to update the nested key with
@param keyPath The path to the key to update ex. fizz.buzz.foo