param { number [ ] } array param { number } target function GetIndexFromRotateArray ( array , target ) { let left = 0 ; let right = array . length - 1 ; while ( left < right ) { let mid = Math . floor ( left + ( right - left ) / 2 ) ; if ( array [ 0 ] <= array [ mid ] && ( target > array [ mid ] || target < array [ 0 ] ) ) { left = mid + 1 ; } else if ( target > array [ mid ] && target < array [ 0 ] ) { left = mid + 1 ; } else { right = mid ; } } return left === right && array [ left ] === target ? left : - 1 ; } export { GetIndexFromRotateArray } ;