How to know if the user is turning to the left or right?

I am using the following plugin, I am trying to know if the user is turning to the left or to the right. I know that if it’s to the right the angle is increasing and if it’s to the left the angle is decreasing. For this I am keeping a variable with the last angle that I got before the new one and compare if it’s smaller of bigger.

However, the problem comes if a user is turning in a place where the angle will be resetted (go from 360 to 0 or viceversa)

How could I detect if the user going to the left or right all the time without stop?

Thanks.