object-utils.ts 231 B

12345678910
  1. // remove property if value is null
  2. export const removeNullPropertyFromObject = <T>(object: T): T => {
  3. for (const [key, value] of Object.entries(object)) {
  4. if (value == null) { delete object[key] }
  5. }
  6. return object;
  7. };