FirstNonEmpty returns the first non-empty slice from the input, or nil if all input slices are empty.
(inputs ...[]T)
| 7 | // FirstNonEmpty returns the first non-empty slice from the input, or nil if |
| 8 | // all input slices are empty. |
| 9 | func FirstNonEmpty[T any](inputs ...[]T) []T { |
| 10 | for _, input := range inputs { |
| 11 | if len(input) > 0 { |
| 12 | return input |
| 13 | } |
| 14 | } |
| 15 | return nil |
| 16 | } |
| 17 | |
| 18 | // GroupBy returns an object composed of keys generated from the results of |
| 19 | // running each element of collection through keyFunc. |
no outgoing calls
searching dependent graphs…