1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-16 00:06:40 +01:00
unleash.unleash/frontend/src/utils/removeEmptyStringFields.ts

10 lines
329 B
TypeScript

// Remove fields from an object if their value is the empty string.
export const removeEmptyStringFields = (object: {
[key: string]: unknown;
}): { [key: string]: unknown } => {
const entries = Object.entries(object);
const filtered = entries.filter(([, v]) => v !== '');
return Object.fromEntries(filtered);
};