summitech / gitexplorer

Find the right git commands without digging through the web.
MIT License
1.84k stars 160 forks source link

Improve PrimaryOptions sort lambda function :) #30

Closed SomeshThakur closed 4 years ago

SomeshThakur commented 5 years ago

We can write it in a more simpler way than the existing code.

SomeshThakur commented 5 years ago

Wow! I never came across this issue. I had a perception that this kind of comparator would work on any simple sorting function. I am pushing a fix which uses ternary operator. :)

setnemo commented 4 years ago

@SomeshThakur Thanks so much for your contribution!

setnemo commented 4 years ago

Это не правильно. Это не сортируется должным образом. Вы можете проверить это вручную, чтобы подтвердить.

I checked it. a = 1; 1 b = 2; 2 a > b ? 1 : a === b ? 0 : -1; -1 a = 2; 2 a > b ? 1 : a === b ? 0 : -1; 0 a = 3; 3 a > b ? 1 : a === b ? 0 : -1; 1

It looks good