diff options
| author | Eyal Posener <[email protected]> | 2017-05-06 22:48:34 +0300 |
|---|---|---|
| committer | Eyal Posener <[email protected]> | 2017-05-06 22:48:34 +0300 |
| commit | 91a264bb4097838b8332a30e8c24953f98b83350 (patch) | |
| tree | 19f72585882834e205513b223210d8d6bcb0ff7a /predicate.go | |
| parent | c20bec01d6d5df7c359ee55d097589b2a2f86368 (diff) | |
add predicate tests
Diffstat (limited to 'predicate.go')
| -rw-r--r-- | predicate.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/predicate.go b/predicate.go index e377429..5b0dcc0 100644 --- a/predicate.go +++ b/predicate.go @@ -13,8 +13,11 @@ type Predicate func(last string) []Matcher // Or unions two predicate functions, so that the result predicate // returns the union of their predication func (p Predicate) Or(other Predicate) Predicate { - if p == nil || other == nil { - return nil + if p == nil { + return other + } + if other == nil { + return p } return func(last string) []Matcher { return append(p.predict(last), other.predict(last)...) } } |
