mirror of
https://github.com/rjNemo/underscore
synced 2026-06-11 04:56:44 +00:00
Documentation comment for OrderBy which I missed out
This commit is contained in:
parent
a197836c1d
commit
a72da82172
1 changed files with 3 additions and 0 deletions
|
|
@ -1,5 +1,8 @@
|
||||||
package underscore
|
package underscore
|
||||||
|
|
||||||
|
// Orders a slice by a field value within a struct, the predicate allow you
|
||||||
|
// to pick the fields you want to orderBy. Use > for ASC or < for DESC
|
||||||
|
// func (left Person, right Person) bool { return person.Age > person.Age }
|
||||||
func OrderBy[T any](list []T, predicate func(T, T) bool) []T {
|
func OrderBy[T any](list []T, predicate func(T, T) bool) []T {
|
||||||
swaps := true
|
swaps := true
|
||||||
var tmp T
|
var tmp T
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue