@lovebowls/leagueelements
Version:
League Elements package for LoveBowls
56 lines • 3.19 kB
TypeScript
/**
* Form calculation utilities for league analysis
* Provides reusable functions for calculating team form scores and historical form data
*/
export class FormUtils {
/**
* Standard form weights for recent matches (most recent to oldest)
* Higher weights for more recent matches to emphasize current form
*/
static FORM_WEIGHTS: number[];
/**
* Get all matches for a team up to a specific date, sorted by date (most recent first)
* @param {string} teamId - The team ID
* @param {Date|null} targetDate - The target date (null for all matches)
* @param {Array<Object>} allMatches - Array of all match objects
* @param {string} tableFilter - Filter type ('overall', 'home', 'away', 'form')
* @returns {Array<Object>} Filtered and sorted matches
*/
static getTeamMatchesUpToDate(teamId: string, targetDate: Date | null, allMatches: Array<Object>, tableFilter?: string): Array<Object>;
/**
* Calculate form score from a specific set of matches for a team
* @param {Array<Object>} matches - Array of match objects (should be sorted most recent first)
* @param {string} teamId - The team ID to calculate form for
* @param {number} maxMatches - Maximum number of matches to consider (default: 5)
* @returns {number} Form score (0-3 range)
*/
static calculateFormScoreFromMatches(matches: Array<Object>, teamId: string, maxMatches?: number): number;
/**
* Calculate form score at a specific date for a team
* @param {string} teamId - The team ID
* @param {Date|null} targetDate - The target date (null for current form)
* @param {Array<Object>} allMatches - Array of all match objects
* @param {string} tableFilter - Filter type ('overall', 'home', 'away', 'form')
* @param {number} maxMatches - Maximum number of matches to consider (default: 5)
* @returns {number} Form score (0-3 range)
*/
static calculateFormScoreAtDate(teamId: string, targetDate: Date | null, allMatches: Array<Object>, tableFilter?: string, maxMatches?: number): number;
/**
* Generate form over time data for multiple teams
* @param {Array<string>} teamIds - Array of team IDs to analyze
* @param {Array<Object>} allMatches - Array of all match objects
* @param {string} tableFilter - Filter type ('overall', 'home', 'away', 'form')
* @param {number} maxMatches - Maximum number of matches to consider for form (default: 5)
* @returns {Object} Form over time data structure
*/
static generateFormOverTimeData(teamIds: Array<string>, allMatches: Array<Object>, tableFilter?: string, maxMatches?: number): Object;
/**
* Calculate form rank movements between two time periods
* @param {Array<string>} teamIds - Array of team IDs
* @param {Array<Object>} allMatches - Array of all match objects
* @param {string} tableFilter - Filter type ('overall', 'home', 'away', 'form')
* @returns {Object} Map of teamId to rank movement
*/
static calculateFormRankMovements(teamIds: Array<string>, allMatches: Array<Object>, tableFilter?: string): Object;
}
//# sourceMappingURL=formUtils.d.ts.map