Skip to content

Commit 91cc0cf

Browse files
author
Marek Dalewski
committed
Add ShouldInclude and ShouldDescend functions
1 parent f17bd20 commit 91cc0cf

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

value.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ const (
5050
skipMask FilterResult = 0b10
5151
)
5252

53+
// ShouldInclude informs if the provided filter result indicates that the given flag value should be included.
54+
func ShouldInclude(r FilterResult) bool {
55+
return r&skipMask == 0
56+
}
57+
58+
// ShouldDescend informs if the provided filter result indicates that the further recursive values finding should descend into sub-values.
59+
func ShouldDescend(r FilterResult) bool {
60+
return r&noDescendMask == 0
61+
}
62+
5363
// Filter applies all filter function to the provided flag value and returns filtering decision.
5464
func Filter(val *Value, filters ...FilterFunc) (r FilterResult) {
5565
if val == nil {

0 commit comments

Comments
 (0)