@0b5vr/experimental
    Preparing search index...

    Function binarySearch

    • Look for an index from a sorted list using binary search.

      If you don't provide a compare function, it will look for the first same value it can find. If it cannot find an exactly matching value, it can return N where the length of given array is N.

      Type Parameters

      • T

      Parameters

      • array: ArrayLike<T>

        A sorted array

      • element: T

      Returns number

      An index found

    • Look for an index from a sorted list using binary search.

      If you don't provide a compare function, it will look for the first same value it can find. If it cannot find an exactly matching value, it can return N where the length of given array is N.

      Type Parameters

      • T

      Parameters

      • array: ArrayLike<T>

        A sorted array

      • compare: (element: T) => boolean

        Make this function return false if you want to point right side of given element, true if you want to point left side of given element.

      Returns number

      An index found