Skip to main content

core.trimtrailingemptyelements

Home > @medplum/core > trimTrailingEmptyElements

trimTrailingEmptyElements() function

Returns an array with trailing empty elements removed. For example, [1, 2, 3, null, undefined, ''] becomes [1, 2, 3]. This is useful for FHIR arrays, which by default must maintain the same length, but while editing we may want to trim trailing empty elements.

Signature:

export declare function trimTrailingEmptyElements<T>(arr: T[] | undefined): T[] | undefined;

Parameters

Parameter

Type

Description

arr

T[] | undefined

The input array.

Returns:

T[] | undefined

The array with trailing empty elements removed.