Typescript Check If Array Is Rotated