import cleaner from "clean-deep"

/**
 * Function to remove empty objects from a fetched content type.
 * Used since Contentstack returns empty objects for all non
 * queried in modular blocks.
 */
export function removeEmptyObjects<T>(obj: T) {
  return cleaner(obj, {
    emptyArrays: false,
    emptyStrings: false,
    nullValues: false,
    undefinedValues: false,
  })
}
