feat: some more tests

This commit is contained in:
Max Richter
2025-08-17 15:20:16 +02:00
parent c687eff53d
commit 6db87db325
4 changed files with 80 additions and 0 deletions

View File

@@ -12,6 +12,11 @@ import (
// - when obj is a map -> if value is a map[string]any, merge into obj; otherwise obj is unchanged.
// - otherwise -> returns obj unchanged.
func SetPathValue(path string, value any, obj any) any {
// check if value is empty string and if so continue
if value == "" || value == nil {
return obj
}
// Split and drop empty segments (so ".", "..", "" become no keys)
raw := strings.Split(path, ".")
keys := raw[:0]