@eroyeroy/utils - v0.1.0
    Preparing search index...

    Function compactArray

    • Removes null and undefined values from an array.

      Type Parameters

      • T

      Parameters

      • array: readonly (T | null | undefined)[]

        The array to compact.

      Returns T[]

      compactArray([1, null, 2, undefined, 3]) // => [1, 2, 3]
      compactArray([null, undefined]) // => []