merge sort, in a javascript module