1
0
mirror of https://github.com/lus/pasty.git synced 2023-08-10 21:13:09 +03:00
pasty/internal/maps/map_utils.go

25 lines
375 B
Go
Raw Normal View History

2023-06-17 21:36:15 +03:00
package maps
func ExceedsDimensions(src map[string]any, width, depth int) bool {
if width < 0 || depth < 1 || len(src) > width {
return true
}
for _, value := range src {
childMap, ok := value.(map[string]any)
if !ok {
continue
}
if depth == 1 {
return true
}
if ExceedsDimensions(childMap, width, depth-1) {
return true
}
}
return false
}