• Finds an element in a collection and returns a tuple with the found element first, and an array with all the rest of the elements second.

    Type Parameters

    • T

    Parameters

    • list: T[]

      The collection to search in.

    • predicate: ListIterator<T, boolean>

      the function to use to find the element.

    Returns [T | undefined, T[]]

    [found, rest], where found is the element found (or undefined), and the rest is an array with all the other elements in the same order.