Function dropLast

  • Returns a new array with the last count elements removed. Returns an empty array if count is not an integer or is negative.

    Example

    import * as A from "flurp/array";

    const withoutLastThree = A.dropLast(3);
    withoutLastThree([10, 20, 30, 40, 50]); // [10, 20]
    withoutLastThree([10, 20]); // []

    Type Parameters

    • T

    Parameters

    • count: number

    Returns ((arr: readonly T[]) => T[])

      • (arr: readonly T[]): T[]
      • Parameters

        • arr: readonly T[]

        Returns T[]