Kaizen
Browse modulesRulesrules/sharedFunctions

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_value is a list. The entry is satisfied when the context's value(s) for scope_type overlap 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

ParameterType
scopes{ scope_type: string; scope_value: string[]; }[]
scopeContextScopeContext

Returns

boolean

On this page