Signed-off-by: Derek McGowan <derek@mcg.dev>
| 13 | 13 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,14 @@ |
| 0 |
+// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: |
|
| 1 |
+//go:build go1.23 |
|
| 2 |
+ |
|
| 3 |
+package maputil |
|
| 4 |
+ |
|
| 5 |
+func FilterValues[K comparable, V any](in map[K]V, fn func(V) bool) []V {
|
|
| 6 |
+ var out []V |
|
| 7 |
+ for _, v := range in {
|
|
| 8 |
+ if fn(v) {
|
|
| 9 |
+ out = append(out, v) |
|
| 10 |
+ } |
|
| 11 |
+ } |
|
| 12 |
+ return out |
|
| 13 |
+} |
| 13 | 13 |
deleted file mode 100644 |
| ... | ... |
@@ -1,14 +0,0 @@ |
| 1 |
-// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16: |
|
| 2 |
-//go:build go1.23 |
|
| 3 |
- |
|
| 4 |
-package maputil |
|
| 5 |
- |
|
| 6 |
-func FilterValues[K comparable, V any](in map[K]V, fn func(V) bool) []V {
|
|
| 7 |
- var out []V |
|
| 8 |
- for _, v := range in {
|
|
| 9 |
- if fn(v) {
|
|
| 10 |
- out = append(out, v) |
|
| 11 |
- } |
|
| 12 |
- } |
|
| 13 |
- return out |
|
| 14 |
-} |