diff options
Diffstat (limited to 'subex/filter.go')
-rw-r--r-- | subex/filter.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/subex/filter.go b/subex/filter.go index ae4b8ab..309d6c7 100644 --- a/subex/filter.go +++ b/subex/filter.go @@ -27,6 +27,26 @@ func (_ anyBoolFilter) valueFilter(value walk.Value) bool { return isBool } +type simpleValueFilter struct {} +func (_ simpleValueFilter) valueFilter(value walk.Value) bool { + switch value := value.(type) { + case walk.NullValue: + return true + case walk.BoolValue: + return true + case walk.NumberValue: + return true + case walk.StringValue: + return true + case walk.ArrayValue: + return len(value) == 0 + case walk.MapValue: + return len(value) == 0 + default: + panic("Invalid value type") + } +} + type anyValueFilter struct {} func (_ anyValueFilter) valueFilter(value walk.Value) bool { return true |