Function last

  • Safely get the last item from a list, returning Just the last item if the array has at least one item in it, or Nothing if it is empty.

    Examples

    let empty = [];
    Maybe.last(empty); // => Nothing

    let full = [1, 2, 3];
    Maybe.last(full); // => Just(3)

    Type Parameters

    • T

    Parameters

    • array: (undefined | null | T)[]

      The array to get the first item from.

    Returns Maybe<T>

Generated using TypeDoc