- add util func RemoveGeneralMapKeys

This commit is contained in:
gazebo
2018-10-28 12:25:19 +08:00
parent 356f622cd0
commit 1db3cc9455
2 changed files with 34 additions and 0 deletions

View File

@@ -201,3 +201,14 @@ func TrimBlanChar(str string) string {
return strValue == " " || strValue == "\t" || strValue == "\n" || strValue == "\r"
})
}
func RemoveGeneralMapKeys(obj map[string]interface{}, keys ...string) map[string]interface{} {
if obj != nil {
for _, key := range keys {
if _, ok := obj[key]; ok {
delete(obj, key)
}
}
}
return obj
}