Skip to main content

Variable: getFormat

const getFormat: (fmt) => FormatConstants = get_format

Defined in: src/models/cricket_wp.ts:361

camelCase alias of get_format.

Resolve a format slug to its FormatConstants (case-insensitive, whitespace trimmed).

Parameters​

fmt​

string

Format slug: 't20' / 'odi' in any case, e.g. ' T20 '. A nullish value is treated as '' (unknown).

Returns​

FormatConstants

The matching FORMAT_TABLE entry.

Throws​

Error Test cricket deferred for 'test'; Unknown cricket format '<fmt>'; expected one of ["odi","t20"] for anything else not in the table.

Remarks​

Divergence from sdv-py, which joins on the raw slug (KeyError for "T20"): the JS port normalises case. Mounted as sdv.cricket.cricket_get_format / cricketGetFormat.

Example​

import sdv from 'sportsdataverse';
sdv.cricket.cricket_get_format(' T20 ').balls_total; // 120