Function: add_strength_state()
add_strength_state(
pbp,goalie_ids?):Row[]
Defined in: src/analytics/hockeytech.ts:730
skaters_home / skaters_away, strength_state ("5v4", home first) and
strength_state_valid (both counts within 3..6) from the on-ice id lists. Goalies
(goalie_ids, coerced to string, NOT de-duplicated) are stripped from the counts;
with none given each side is assumed to carry exactly one. No empty-net flag is
derived here (the shift feed does not carry goalie presence reliably).
Parameters
pbp
Row[]
Rows carrying on_ice_home / on_ice_away (comma-joined ids from
build_on_ice). Without both columns every row gets null for all four outputs.
goalie_ids?
Iterable<unknown, any, any> | null
Goalie ids (any scalar; compared as strings) to subtract from the on-ice
counts. null / undefined / [] all mean "assume one goalie per side". Default null.
Returns
Row[]
A new array of copied rows with skaters_home / skaters_away (on-ice count minus
goalies; null when that side's list is null), strength_state ('<home>v<away>',
null if either count is null) and strength_state_valid (Kleene AND of "count in
3..6" per side: false if either is out of range, null if either is null, else true).
Example
import { add_strength_state } from "sportsdataverse/dist/analytics/hockeytech.js";
const rows = add_strength_state(enrichedPbp, ["105", "212"]); // two goalie ids
rows[0].strength_state; // e.g. "5v4"
Remarks
A goalie id listed twice is subtracted twice (NOT de-duplicated). strength_state
is home-first regardless of which team the event belongs to.