Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes sorting of strings of numbers #2

Merged
merged 1 commit into from
Jul 5, 2024

Conversation

sniperrifle2004
Copy link
Contributor

I would also have added a test to check for this, but given the current test format (using the examples in the level data) that was a bit to involved. It passes the test suite at least

Since Array.sort sorts all values as strings
by default, using it on arrays of numbers causes
wrong results depending on the input. e.g. [2,1,10]
would be sorted as [1,10,2]. Using this custom
compare function should solve that.

Fixes atesgoral#1
@atesgoral atesgoral merged commit 2a1b9ea into atesgoral:master Jul 5, 2024
@atesgoral
Copy link
Owner

@sniperrifle2004 Sorry! For some reason I never saw this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants