Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "array/get-previous-wrap-around"

Index

Functions

getPreviousWrapAround

  • getPreviousWrapAround<T, A>(array: A, element: T): A extends Readonly<NonEmptyArray<T>> ? T : T | undefined
  • Convenience function to get the previous element in this array after some element, wrapping around if it would walk off the array.

    see

    getWrapAround

    Type parameters

    • T

    • A: ReadonlyArray<T>

    Parameters

    • array: A

      The array to get elements in.

    • element: T

      The element in the array to get the previous element before.

    Returns A extends Readonly<NonEmptyArray<T>> ? T : T | undefined

    The previous element in the array after the element, or wraps to the beginning if that element is the last element.

Generated using TypeDoc