Reference
Operators

Rule Operators

When configuring conditional rules for feature flags, you can use different operators based on the property type.

String Operators

OperatorDescriptionExample
eqExact string matchrole eq "admin"
neqNot equalrole neq "guest"
containsString contains substringemail contains "@company.com"
notContainsString does not contain substringplan notContains "free"
startsWithString starts with prefixcountry startsWith "US"
endsWithString ends with suffixdomain endsWith ".edu"
regexString matches regular expressionemail regex "^[a-z]+@.*$"

Number Operators

OperatorDescriptionExample
eqEqual toage eq 21
neqNot equal tologinCount neq 0
gtGreater thanpurchaseCount gt 5
gteGreater than or equal tosubscriptionMonths gte 3
ltLess thanerrorCount lt 10
lteLess than or equal tofailedAttempts lte 3

Boolean Operators

OperatorDescriptionExample
eqEqual toisSubscribed eq true

Rule Groups

Rules can be combined into groups using logical operators:

OperatorDescriptionExample
andAll conditions in the group must matchrole eq "admin" AND subscriptionDays gt 30
orAny condition in the group can matchisTeamMember eq true OR hasBetaAccess eq true

Example Rule Sets

// Single rule
{
  propertyName: "role",
  propertyType: "string",
  operator: "eq",
  value: "admin",
  thenValue: true
}
 
// Rule group with AND logic
{
  operator: "and",
  rules: [
    {
      propertyName: "subscriptionTier",
      propertyType: "string",
      operator: "eq",
      value: "premium"
    },
    {
      propertyName: "usageCount",
      propertyType: "number",
      operator: "gt",
      value: 100
    }
  ],
  thenValue: true
}
 
// Rule group with OR logic
{
  operator: "or",
  rules: [
    {
      propertyName: "isAdmin",
      propertyType: "boolean",
      operator: "eq",
      value: true
    },
    {
      propertyName: "email",
      propertyType: "string",
      operator: "endsWith",
      value: "@company.com"
    }
  ],
  thenValue: true
}

When evaluating rules:

  1. Rules are evaluated in order
  2. The first matching rule's thenValue is used
  3. If no rules match, the environment's default value is used