function flatKeys(obj, prefix, arrayIdxs) {
  const keys = []
  const seen = []
  recurse(prefix || '', obj)
  return keys

  function recurse(p, o) {
    seen.push(o)

    for (const key in o) {
      if (seen.indexOf(o[key]) !== -1) {
        continue
      }

      if (o[key] instanceof Object && (arrayIdxs || !Array.isArray(o[key]))) {
        recurse(p + key + '.', o[key])
      } else {
        keys.push(p + key)
      }
    }
  }
}
Retrieves all the keys that would exist in the flattened version of the object.

@private
@param {object}  obj       - The object to get the flat keys of.
@param {string}  prefix    - A prefix for the keys, usually `''`.
@param arrayIdxs
@param {boolean}    arrayIdx  - Flag indicating if array indexes should be iterated.
@returns {Array.<string>} An array of keys names.