Options
All
  • Public
  • Public/Protected
  • All
Menu

Module array/dropLast

Index

References

Functions

References

Renames and re-exports dropLast

Functions

  • dropLast(n: number, xs: string): string
  • dropLast<T>(n: number, xs: ArrayLike<T>): T[]
  • dropLast(n: number): { (xs: string): string; <T>(xs: ArrayLike<T>): T[] }
  • Returns a list containing all but the last n elements of the given list.

    example
     dropLast(1, ['foo', 'bar', 'baz']); //=> ['foo', 'bar']
    dropLast(2, ['foo', 'bar', 'baz']); //=> ['foo']
    dropLast(3, ['foo', 'bar', 'baz']); //=> []
    dropLast(4, ['foo', 'bar', 'baz']); //=> []
    dropLast(3, 'ramda'); //=> 'ra'

    Parameters

    • n: number

      The number of elements of list to skip.

    • xs: string

      The list of elements to consider.

    Returns string

    A copy of the list with only the first list.length - n elements

  • Returns a list containing all but the last n elements of the given list.

    example
     dropLast(1, ['foo', 'bar', 'baz']); //=> ['foo', 'bar']
    dropLast(2, ['foo', 'bar', 'baz']); //=> ['foo']
    dropLast(3, ['foo', 'bar', 'baz']); //=> []
    dropLast(4, ['foo', 'bar', 'baz']); //=> []
    dropLast(3, 'ramda'); //=> 'ra'

    Type parameters

    • T

    Parameters

    • n: number

      The number of elements of list to skip.

    • xs: ArrayLike<T>

      The list of elements to consider.

    Returns T[]

    A copy of the list with only the first list.length - n elements

  • Returns a list containing all but the last n elements of the given list.

    example
     dropLast(1, ['foo', 'bar', 'baz']); //=> ['foo', 'bar']
    dropLast(2, ['foo', 'bar', 'baz']); //=> ['foo']
    dropLast(3, ['foo', 'bar', 'baz']); //=> []
    dropLast(4, ['foo', 'bar', 'baz']); //=> []
    dropLast(3, 'ramda'); //=> 'ra'

    Parameters

    • n: number

      The number of elements of list to skip.

    Returns { (xs: string): string; <T>(xs: ArrayLike<T>): T[] }

    A copy of the list with only the first list.length - n elements

      • (xs: string): string
      • <T>(xs: ArrayLike<T>): T[]
      • Parameters

        • xs: string

        Returns string

      • Type parameters

        • T

        Parameters

        • xs: ArrayLike<T>

        Returns T[]

Generated using TypeDoc