Skip to content

removeUndefinedProperties<Type>

Removes all undefined properties from an object.

Import:

import { removeUndefinedProperties } from 'obsidian-dev-utils/object-utils';

Signature:

function removeUndefinedProperties(obj: Type, keysToKeep: readonly string[] | undefined): Type

Parameters:

ParameterTypeDescription
objTypeThe object to remove undefined properties from.
keysToKeepreadonly string[] | undefinedThe keys to keep.

Returns: Type — The object with all undefined properties removed.