package main
import (
"fmt"
mapsutil "github.com/projectdiscovery/utils/maps"
)
func main() {
om := mapsutil.NewOrderedMap[string, string]()
om.Set("offset", "0")
om.Set("limit", "10")
om.Set("sort", "desc")
om.Set("cwe-id", "CWE-77")
ignoreKeys := []string{"offset", "limit", "sort"}
om.Iterate(func(key string, value string) bool {
fmt.Println(key, value)
for _, ignoreKey := range ignoreKeys {
if key == ignoreKey {
om.Delete(key)
break
}
}
return true
})
}
Output:
offset 0
sort desc
cwe-id CWE-77
cwe-id CWE-77
Expected:
offset 0
limit 10
sort desc
cwe-id CWE-77