function flatten(v) {
  /** @type {T[]} */
  const result = []
  if (v) {
    if (isIterable(v)) {
      result.push(...v)
    } else {
      result.push(v)
    }
  }
  return result
}
Flattens arrays, objects and iterable objects.
@template T
@param {T | Iterable<T> | null | undefined} v
@returns {T[]}