Skip to content

Commit

Permalink
Merge pull request #34 from statsig-io/add-str-contains-none
Browse files Browse the repository at this point in the history
add string contains none operator
  • Loading branch information
jkw-statsig authored Sep 8, 2021
2 parents 6fad1a8 + d783cdd commit b43057e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/evaluation/evaluator.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ func (e *Evaluator) evalCondition(user types.StatsigUser, cond ConfigCondition)
pass = arrayAny(cond.TargetValue, value, func(x, y interface{}) bool {
return compareStrings(x, y, true, func(s1, s2 string) bool { return strings.Contains(s1, s2) })
})
case "str_contains_none":
pass = !arrayAny(cond.TargetValue, value, func(x, y interface{}) bool {
return compareStrings(x, y, true, func(s1, s2 string) bool { return strings.Contains(s1, s2) })
})
case "str_matches":
matched, _ := regexp.MatchString(cond.TargetValue.(string), value.(string))
pass = matched
Expand Down

0 comments on commit b43057e

Please sign in to comment.