Skip to main content

Function: compact()

compact(this, left, prop?): unknown[]

Remove null and undefined values from an array-like object. If given, the argument should be the name of a property that exists on each object in the array-like sequence.

Parameters

this: FilterContext

An object containing a reference to the active render context and any keyword/named arguments.

left: unknown

Any value.

prop?: unknown

The name of a property to check for null or undefined values. Each object in the input iterable should have this property.

Returns

unknown[]

  • A new array with null and undefined values removed.

Defined in

src/builtin/filters/array.ts:109