PitchKit
API Reference@pitchkit/data-providersstatsbombFunctions

indexThreeSixtyByEvent()

function indexThreeSixtyByEvent(frames): Map<string, StatsBombThreeSixtyFrame>;

Defined in: packages/data-providers/src/statsbomb/select.ts:105

Join 360 frames to the events they belong to — frame.event_uuid equals the matching StatsBombEvent.id. Build this once with the frames array and reuse it via .get(event.id); that's far cheaper than .find()-ing the frames array per event when scrubbing through a whole match's worth of them.

const frames = indexThreeSixtyByEvent(await fetchMatchThreeSixty(matchId));
const frame = frames.get(event.id); // undefined if this event has no 360 coverage

Parameters

ParameterType
framesreadonly StatsBombThreeSixtyFrame[]

Returns

Map<string, StatsBombThreeSixtyFrame>

On this page