Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: pluralsh/polly
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.1.8
Choose a base ref
...
head repository: pluralsh/polly
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.1.9
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on May 13, 2024

  1. add MapKeys method (#32)

    * add MapKeys method
    
    * fix unit test
    zreigz authored May 13, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ce04ead View commit details
Showing with 8 additions and 0 deletions.
  1. +8 −0 algorithms/map.go
8 changes: 8 additions & 0 deletions algorithms/map.go
Original file line number Diff line number Diff line change
@@ -8,6 +8,14 @@ func MapValues[K comparable, V any](m map[K]V) []V {
return s
}

func MapKeys[K comparable, V any](m map[K]V) []K {
s := make([]K, 0, len(m))
for k := range m {
s = append(s, k)
}
return s
}

func Merge(maps ...map[string]interface{}) map[string]interface{} {
res := maps[0]
for _, m := range maps[1:] {