Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

481 B
Raw Blame
import { ValueMatcher } from '~/types'

/**
 * The rollout gate those features share: an allowlist ('*' or explicit team
 * IDs) minus an exclusion list, where exclusion always wins.
 */
export function buildTeamGate(teams: number[] | '*', excludedTeams: number[]): ValueMatcher<number> {
    const allowed = teams === '*' ? '*' : new Set(teams)
    const excluded = new Set(excludedTeams)
    return (teamId) => !excluded.has(teamId) && (allowed === '*' || allowed.has(teamId))
}