Skip to content

removeEmptyFrontmatterValues

Removes the empty values from a front matter object, at any nesting depth.

By default only empty strings are removed — both as property values and as array items. null, undefined, empty arrays and empty objects are kept unless the corresponding option is enabled.

The object is modified in place, so the function can be called straight from a processFrontmatter() callback.

Import:

import { removeEmptyFrontmatterValues } from 'obsidian-dev-utils/obsidian/frontmatter';

Signature:

function removeEmptyFrontmatterValues(params: RemoveEmptyFrontmatterValuesParams): string[]

Parameters:

ParameterTypeDescription
paramsRemoveEmptyFrontmatterValuesParamsThe parameters for removing the empty front matter values.

Returns: string[] — The dot-separated key paths of the removed values, in the order they were removed. An array item is reported by its index within the array as it was before any of its siblings were removed, e.g. tags.0.


Links to this page: