aboutsummaryrefslogtreecommitdiff
path: root/pkg/u/list.go
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-06-09 19:35:34 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-06-09 19:35:34 +0200
commit02614b3781f6acdfc6df0e7b07d856b2779c4ac7 (patch)
treef23518fcf263be3236265852ba338c4fec137b41 /pkg/u/list.go
parentb1ad6e98445cf7dafa6fec1e2e769051fe7cb748 (diff)
downloadcerrado-02614b3781f6acdfc6df0e7b07d856b2779c4ac7.tar.gz
cerrado-02614b3781f6acdfc6df0e7b07d856b2779c4ac7.tar.bz2
cerrado-02614b3781f6acdfc6df0e7b07d856b2779c4ac7.zip
feat: Per repository configuration
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 cf71909..7271ef3 100644
--- a/pkg/u/list.go
+++ b/pkg/u/list.go
@@ -16,6 +16,14 @@ func FirstOrZero[T any](v []T) T {
return v[0]
}
+func Map[T any, V any](ts []T, fun func(T) V) []V {
+ rs := make([]V, len(ts))
+ for i := range ts {
+ rs[i] = fun(ts[i])
+ }
+ return rs
+}
+
func ChunkBy[T any](items []T, chunkSize int) [][]T {
var chunks = make([][]T, 0, (len(items)/chunkSize)+1)
for chunkSize < len(items) {