repackage code to cmd

This commit is contained in:
2025-11-13 20:11:00 +01:00
parent 0989fdb3cc
commit f0068f0905
29 changed files with 118 additions and 128 deletions

19
cmd/generics.go Normal file
View File

@@ -0,0 +1,19 @@
package cmd
// find an item in a list, generic variant
func Contains[E comparable](s []E, v E) bool {
for _, vs := range s {
if v == vs {
return true
}
}
return false
}
func Exists[K comparable, V any](m map[K]V, v K) bool {
if _, ok := m[v]; ok {
return true
}
return false
}