Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Functions

Functions

getNextWrapAround

  • getNextWrapAround<T, A>(array: A, element: T): A extends Readonly<NonEmptyArray<T>> ? T : T | undefined
  • Convenience function to get the next 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 next element after.

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

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

Generated using TypeDoc