Function compactArray

  • Accepts an array which might be a mix of values and null/undefined and returns the same array without said null/undefined values.

    Type Parameters

    • T

    Parameters

    • elements: (undefined | null | T)[]

      the array to compact

    Returns T[]