nl_tokens: Searches the specified Array for the provided key using the binary search algorithm . The Array must be sorted .
pl_tokens: function binarySearch ( arr , key , compareFunc ) { let low = 0 ; let high = arr . length - 1 ; while ( low <= high ) { const mid = ( low + high ) >>> 1 ; const midVal = arr [ mid ] ; const cmp = compareFunc ( midVal , key ) ; if ( cmp < 0 ) { low = <mask> + 1 ; } else if ( cmp > 0 ) { high = mid - 1 ; } else { //The key was found in the Array return mid ; } } // key not found return ~ low ; }