Files
Dominik Schulz 7ee5b1384b Handle Unix, Windows and Mac line endings in recipients parsing (#2221)
Fixes #2220

RELEASE_NOTES=[BUGFIX] Handle different line breaks in recipient
handling.

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
2022-05-22 10:00:55 +02:00

23 lines
437 B
Go

package set
// Map takes a slice of a given type and create a boolean map with keys
// of that type.
func Map[K comparable](in []K) map[K]bool {
m := make(map[K]bool, len(in))
for _, i := range in {
m[i] = true
}
return m
}
// Apply applies the given function to every element of the slice.
func Apply[K comparable](in []K, f func(K) K) []K {
out := make([]K, len(in))
for i, v := range in {
out[i] = f(v)
}
return out
}