export default function haselementsininterval < T > ( sorted_list , valueFn , lower_inc_val , upper_exc_val ) { let test_lower_inc = 0 ; let test_upper_exc = sorted_list . length ; let middle , middle_val ; let ret = false ; while ( true ) { if ( test_lower_inc >= test_upper_exc ) { break ; } middle = Math . floor ( ( test_lower_inc + test_upper_exc ) / 2 ) ; middle_val = valueFn ( sorted_list [ middle ] ) ; if ( middle_val >= upper_exc_val ) { test_upper_exc = middle ; } else if ( middle_val < lower_inc_val ) { test_lower_inc = middle + 1 ; } else { ret = true ; break ; } } return ret ; } ;