function traverse (object, path) {
  if (path && typeof path === 'string') {
    return traverse(object, path.split('.'))
  }

  let obj = object

  if (path) {
    for (let i = 0; i < path.length; i++) {
      const key = path[i]
      if (!(key in obj)) {
        obj[key] = {}
      }
      obj = obj[key]
    }
  }

  return obj
}
Traverse a path into an object.
When a namespace is missing, it will be created
@param {Object} object
@param {string | string[]} path   A dot separated string like 'name.space'
@return {Object} Returns the object at the end of the path