@mirei/ts-collections
    Preparing search index...

    Function skipLast

    • Omits a specified number of elements from the end of the sequence.

      Type Parameters

      • TElement

        Type of elements within the source iterable.

      Parameters

      • source: Iterable<TElement>

        The source iterable.

      • count: number

        Number of trailing elements to exclude. Values less than or equal to zero leave the sequence unchanged.

      Returns IEnumerable<TElement>

      A deferred sequence excluding the last count elements.

      The implementation buffers up to count elements to determine which items to drop, which can increase memory usage for large counts.

      const numbers = [1, 2, 3, 4, 5];
      const skipped = skipLast(numbers, 2).toArray();
      console.log(skipped); // [1, 2, 3]