Pathfinder 1e for Foundry VTT
    Preparing search index...

    Function binarySearch

    • Internal

      A simple binary search to be used on sorted arrays

      Type Parameters

      • T

      Parameters

      • searchArr: T[]

        Sorted Array to be searched

      • el: T

        Element to be compared to array values

      • compare_fn: (arg0: T, arg1: T) => number

        Comparison function to be apply el to every element in ar. Should return an positive/ negative integer or 0 if matching.

      Returns number

      Index where search is found or negative index indicating where it would be inserted