mirror of
https://github.com/rjNemo/underscore
synced 2026-06-06 02:26:42 +00:00
switching to use 'sliceStable'
This commit is contained in:
parent
9f63a51280
commit
80a84c0803
1 changed files with 2 additions and 2 deletions
|
|
@ -8,14 +8,14 @@ import (
|
|||
|
||||
// sort any slice ASENDING
|
||||
func SortSliceASC[T constraints.Ordered](s []T) {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return s[i] < s[j]
|
||||
})
|
||||
}
|
||||
|
||||
// sort any slice DESCENDING
|
||||
func SortSliceDESC[T constraints.Ordered](s []T) {
|
||||
sort.Slice(s, func(i, j int) bool {
|
||||
sort.SliceStable(s, func(i, j int) bool {
|
||||
return s[i] > s[j]
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue