A stable array sort for JavaScript