aboutsummaryrefslogtreecommitdiff
path: root/pkg/u/list.go
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2025-02-15 17:33:24 +0100
committerGabriel A. Giovanini <mail@gabrielgio.me>2025-02-15 17:33:24 +0100
commit27400b0fce5d4ef3b7fd5ef4d25bac8f00754e33 (patch)
treeb1e4df482d7c78e1d7fc56e862b7c266ba2b8e8b /pkg/u/list.go
parent4708ad8ffd96f3b457ff9d3a9660e7d0aa59a4b1 (diff)
downloadcerrado-27400b0fce5d4ef3b7fd5ef4d25bac8f00754e33.tar.gz
cerrado-27400b0fce5d4ef3b7fd5ef4d25bac8f00754e33.tar.bz2
cerrado-27400b0fce5d4ef3b7fd5ef4d25bac8f00754e33.zip
feat: Add wrapper for commit
Add a wrapper to the commit log that also contains possible reference. This will be useful once to later display the reference in the commit log.
Diffstat (limited to 'pkg/u/list.go')
-rw-r--r--pkg/u/list.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/u/list.go b/pkg/u/list.go
index 835ecd2..1cffbd5 100644
--- a/pkg/u/list.go
+++ b/pkg/u/list.go
@@ -12,6 +12,14 @@ func Filter[T any](v []T, f func(T) bool) []T {
return result
}
+func Map[T any, V any](a []T, f func(T) V) []V {
+ result := make([]V, len(a))
+ for i, v := range a {
+ result[i] = f(v)
+ }
+ return result
+}
+
func First[T any](v []T) (T, bool) {
if len(v) == 0 {
var zero T