[javascript] Export sorting functions directly