Refactored compare.js

* removed unnecessary import
* implemented compares using the spaceship operator
* removed the dynamic type order mapping generation (it was pretty unnecessary)