function setNestedKey(obj, keys, value) {
  const len = keys.length
  for (let i = 0; i < len - 1; i++) {
    const elem = keys[i]
    if (!obj[elem]) {
      obj[elem] = {}
    }

    obj = obj[elem]
  }

  obj[keys[len - 1]] = value
}
Properly sets the value of a nested key by creating the shells of empty parents

@param {object} obj object to assign value to
@param {Array} keys list of parent keys
@param {value} value to assign the nested key