function renderKey(path, key, dots) {
  if (!path) return key;
  return path.concat(key).map(function each(token, i) {
    // eslint-disable-next-line no-param-reassign
    token = removeBrackets(token);
    return !dots && i ? '[' + token + ']' : token;
  }).join(dots ? '.' : '');
}
It takes a path, a key, and a boolean, and returns a string

@param {string} path - The path to the current key.
@param {string} key - The key of the current object being iterated over.
@param {string} dots - If true, the key will be rendered with dots instead of brackets.

@returns {string} The path to the current key.