nodejs apparently does not have Math.sign, also moved TYPE_ORDER to be local to compare.js