mathjs
mathjs copied to clipboard
setDistinct changes order
Nothing in the documentation for setDistinct implies anything about sorting the array/matrix, yet:
math.setDistinct([3, 1, 2]); // [1, 2, 3]
math.setDistinct(['h', 'e', 'l', 'l', 'o']); // ['e', 'h', 'l', 'o']
Expected
math.setDistinct([3, 1, 2]); // [3, 1, 2]
math.setDistinct(['h', 'e', 'l', 'l', 'o']); // ['h', 'e', 'l', 'o']
Docs: setDistinct
Code: .sort(compareNatural)