node_modules/snyk/dist/cli/139.index.js
/**
 * Binary search implementation (recursive)
 */
Binary search implementation (recursive)
Binary search implementation ( recursive )
function binarySearch(arr, searchValue) {
  function find(arr, searchValue, left, right) {
    if (right < left)
      return -1;
    var mid = Math.floor((left + right) >>> 1);
    if (searchValue > arr[mid])
      return find(arr, searchValue, mid + 1, right);
    if (searchValue < arr[mid])
      return find(arr, searchValue, left, mid - 1);
    return mid;
  };
  return find(arr, searchValue, 0, arr.length - 1);
}
function binarySearch ( arr , searchValue ) { function find ( arr , searchValue , left , right ) { if ( right < left ) return - 1 ; var mid = Math . floor ( ( left + right ) >>> 1 ) ; if ( searchValue > arr [ mid ] ) return find ( arr , searchValue , mid + 1 , right ) ; if ( searchValue < arr [ mid ] ) return find ( arr , searchValue , left , mid - 1 ) ; return mid ; } ; return find ( arr , searchValue , 0 , arr . length - 1 ) ; }
Binary search implementation (recursive)
Binary search implementation ( recursive )
/*
    int mid = mid = (left + right) / 2;
    There is a bug in the above line;
    Joshua Bloch suggests the following replacement:
    */