/**
 * Safely concatenate a bunch of arrays, which may or may not exist.
 * Purrs quietly when pet.
 */
export function softCat(...lists) {
  const out = []
  return out.concat(...lists.filter((list) => list != null))
}

/**
 * Like `Object.assign`, but makes the properties non-enumerable.
 */
export function addHiddenProperties(
  object,
  properties
) {
  for (const name of Object.keys(properties)) {
    Object.defineProperty(object, name, {
      writable: true,
      configurable: true,
      // @ts-expect-error
      value: properties[name]
    })
  }
  return object 
}
