@jonahsnider/util

    Type Alias DirectionFn<T>

    DirectionFn: (element: T) => number

    A function used to determine the direction a search algorithm should take when traversing data to find a desired element.

    Type Parameters

    • T

    Type declaration

      • (element: T): number
      • Parameters

        • element: T

        Returns number

        0 when the desired element has been found. A positive number when the desired element appears after the current element. A negative number when the desired element appears before the current element.

    function directionFn(value: number) {
    const squared = value ** 2;

    return squared - 64;
    }
    MMNEPVFCICPMFPCPTTAAATR