mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-04 02:37:50 +08:00
21 lines
352 B
Go
21 lines
352 B
Go
package eval
|
|
|
|
// Some generic utils that should appear in the standard library soon.
|
|
|
|
func mapKeys[K comparable, V any](m map[K]V) []K {
|
|
ks := make([]K, 0, len(m))
|
|
for k := range m {
|
|
ks = append(ks, k)
|
|
}
|
|
return ks
|
|
}
|
|
|
|
func sliceContains[T comparable](xs []T, y T) bool {
|
|
for _, x := range xs {
|
|
if x == y {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|