refactored compare.js
nodejs apparently does not have Math.sign, also moved TYPE_ORDER to be local to compare.js
Merge pull request #5244 from adamnemecek/compare

Refactored compare.js
merged