mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 23:15:26 +02:00
feat(utils): Add KeysAsSet
This commit is contained in:
parent
3f102e283d
commit
433cd9ee4c
@ -73,6 +73,16 @@ func FilterMapWhere[T comparable, O any](values map[T]O, f func(T, O) bool) map[
|
||||
return result
|
||||
}
|
||||
|
||||
func KeysAsSet[T comparable, O any](values map[T]O) map[T]struct{} {
|
||||
set := make(map[T]struct{})
|
||||
|
||||
for key := range values {
|
||||
set[key] = struct{}{}
|
||||
}
|
||||
|
||||
return set
|
||||
}
|
||||
|
||||
func KeysOfMap[T comparable, O any](values map[T]O) []T {
|
||||
keys := make([]T, 0)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user