You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Array.prototype.sort's compare function is optional and it automatically handles sorting number[], string[], etc. I think we should do the same with Array.sort(et al) making the Order arg optional and relying on the default whenever possible. Array.sort() is more convenient and would be more performant than Array.sort(Order.number) or Array.sort(Order.string)
What is the feature you are proposing to solve the problem?
^
What alternatives have you considered?
No response
The text was updated successfully, but these errors were encountered:
jessekelly881
changed the title
Make Array.sort order arg optional to match js implementation.
Make Array.sort Order arg optional to match js implementation.
Apr 23, 2024
The mutability of .sort isn't relevant here though. I'm only suggesting that we change Array.sort(o: Order) to Array.sort(o?: Order) without changing the implementation. A compare fn isn't required when using either Array.prototype.sort or Array.prototype.toSorted unless you want to override the default behavior.
What is the problem this feature would solve?
Array.prototype.sort
's compare function is optional and it automatically handles sorting number[], string[], etc. I think we should do the same with Array.sort(et al) making the Order arg optional and relying on the default whenever possible.Array.sort()
is more convenient and would be more performant thanArray.sort(Order.number)
orArray.sort(Order.string)
What is the feature you are proposing to solve the problem?
^
What alternatives have you considered?
No response
The text was updated successfully, but these errors were encountered: