: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { Scope } from '../../scope'
import { Pattern } from '../predicate'
import { Expr } from './base'
import { FilterExpr } from './filter'
export class RejectExpr extends FilterExpr {
constructor(from: Expr, where: Pattern | null, ifEmpty: Expr | null) {
super(from, where, ifEmpty)
}
eval(scope: Scope): unknown {
const arr = this.from.eval(scope)
if (!Array.isArray(arr)) {
return this.onNotArray(scope)
}
const result = this.where ? arr.filter((item) => !this.where!.matches(item)) : arr
return this.withIfEmpty(result, scope)
}
}