UNPKG

@atlaskit/atlassian-navigation

Version:

A horizontal navigation component for Atlassian apps.

17 lines 532 B
/** * Returns a new object with only non-empty properties of the input object. * * In this context, "empty" refers to properties with `null`, `undefined`, or `""` * (empty string) values. * * @param obj - The input object. * @returns A new object with non-empty properties of the input object. */ export function stripEmptyProperties(obj) { return Object.entries(obj).reduce((acc, [key, value]) => { if (value !== null && value !== undefined && value !== '') { acc[key] = value; } return acc; }, {}); }