Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

425 B
Raw Blame
import { isEmpty, isNil, omitBy } from 'lodash-es';

/**
 * Drops the keys a user never filled in. `false` and `0` are kept: they are
 * choices, not blanks.
 */
export function omitBlank<T extends Record<string, unknown>>(
	source: T,
): Partial<T> {
	return omitBy(
		source,
		(value) =>
			isNil(value) ||
			value === '' ||
			((Array.isArray(value) || typeof value === 'object') && isEmpty(value)),
	) as Partial<T>;
}