eval
Evaluates the given formula resulting in unit interval 0, 1, the frequency of returning true. 0 is always false, 1 is always true, 0.5 is true ~50% of the time, depending on the environment.
Example formulas:
Always true:
1
ortrue
True for half of the contexts:
0.5
True for an email domain: `matches("*@doist.com", env"user.email")
True for specific UTC offsets:
contains(["+01:00", "+02:00"], env["user.utc_offset"])
True after a date/time:
gte(now(), datetime("2038-01-19T04:14:07+01:00")
True if the user is logged in:
not(isblank(env["user.email"]))
Gradual rollout:
map(datetime("2021-11-08"), datetime("2021-11-16"), 0, 1, now())
See also
Parameters
formula
the formula to parse.
env
the environment map. Accepted values are booleans, numbers, strings, or lists of them.