Function: matchScopes()
function matchScopes(scopes: {
scope_type: string;
scope_value: string[];
}[], scopeContext: ScopeContext): boolean;Defined in: shared/rules/engine.ts:162
Check if a rule's scopes match the given scope context.
- A rule with no scope entries (
scopes: []) matches everything. - Each scope entry's
scope_valueis a list. The entry is satisfied when the context's value(s) forscope_typeoverlap the listed values (OR within an entry). The context value may itself be a single string or an array, e.g. an order spanning several venues, so both sides are compared as sets. - Multiple scope entries are AND-combined. Every entry must match.
- An empty
scope_value([]) matches nothing.
Parameters
| Parameter | Type |
|---|---|
scopes | { scope_type: string; scope_value: string[]; }[] |
scopeContext | ScopeContext |
Returns
boolean