From d783cdd68293c1ed7666b6e8c23c687b2ab0e37b Mon Sep 17 00:00:00 2001 From: Jiakan Wang Date: Wed, 8 Sep 2021 14:01:19 -0700 Subject: [PATCH] add string contains none operator --- internal/evaluation/evaluator.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/evaluation/evaluator.go b/internal/evaluation/evaluator.go index 5408729..d48dfb6 100644 --- a/internal/evaluation/evaluator.go +++ b/internal/evaluation/evaluator.go @@ -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