It's obviously not a general 3-way comparison API, _because_ it's returning bool!
Extremely strange to see a sort that returns bool, which is one of two common sort comparator APIs, and assume it's a wrong implementation of the other common sort API.
I do see why you're assuming JS, but you shouldn't assume it's any extant programming language. It's explanatory pseudocode.