/** * Formatting utilities for dates, keys, and other values * @module */ /** * Formats a date as YYYY-MM-DD * * @param date - Date to format * @returns Formatted date string * * @example * ```typescript * formatDate(new Date('2024-11-15T12:00:00Z')); // "2024-11-15" * formatDate(new Date()); // Current date in YYYY-MM-DD format * ``` */ export declare function formatDate(date: Date): string; /** * Parses a YYYY-MM-DD date string into a Date object * * @param dateString - Date string to parse * @returns Date object * * @example * ```typescript * parseDate('2024-11-15'); // Date object for Nov 15, 2024 * ``` */ export declare function parseDate(dateString: string): Date; /** * Gets today's date in YYYY-MM-DD format * * @returns Today's date * * @example * ```typescript * getToday(); // "2024-11-15" (if today is Nov 15, 2024) * ``` */ export declare function getToday(): string; /** * Extracts the game ID from a resource key * * @param key - Resource key (e.g., "423.l.12345") * @returns Game ID * * @example * ```typescript * extractGameId('423.l.12345'); // "423" * extractGameId('423.l.12345.t.1'); // "423" * ``` */ export declare function extractGameId(key: string): string; /** * Extracts the resource type from a resource key * * @param key - Resource key (e.g., "423.l.12345") * @returns Resource type ('l', 't', 'p', etc.) * * @example * ```typescript * extractResourceType('423.l.12345'); // "l" * extractResourceType('423.l.12345.t.1'); // "l" * extractResourceType('423.p.8888'); // "p" * ``` */ export declare function extractResourceType(key: string): string; /** * Extracts the resource ID from a resource key * * @param key - Resource key (e.g., "423.l.12345") * @returns Resource ID * * @example * ```typescript * extractResourceId('423.l.12345'); // "12345" * extractResourceId('423.p.8888'); // "8888" * ``` */ export declare function extractResourceId(key: string): string; /** * Extracts the league key from a team key * * @param teamKey - Team key (e.g., "423.l.12345.t.1") * @returns League key * * @example * ```typescript * extractLeagueKey('423.l.12345.t.1'); // "423.l.12345" * ``` */ export declare function extractLeagueKey(teamKey: string): string; /** * Builds a league key from game ID and league ID * * @param gameId - Game ID * @param leagueId - League ID * @returns League key * * @example * ```typescript * buildLeagueKey('423', '12345'); // "423.l.12345" * buildLeagueKey(423, 12345); // "423.l.12345" * ``` */ export declare function buildLeagueKey(gameId: string | number, leagueId: string | number): string; /** * Builds a team key from league key and team ID * * @param leagueKey - League key * @param teamId - Team ID * @returns Team key * * @example * ```typescript * buildTeamKey('423.l.12345', '1'); // "423.l.12345.t.1" * buildTeamKey('423.l.12345', 1); // "423.l.12345.t.1" * ``` */ export declare function buildTeamKey(leagueKey: string, teamId: string | number): string; /** * Builds a player key from game ID and player ID * * @param gameId - Game ID * @param playerId - Player ID * @returns Player key * * @example * ```typescript * buildPlayerKey('423', '8888'); // "423.p.8888" * buildPlayerKey(423, 8888); // "423.p.8888" * ``` */ export declare function buildPlayerKey(gameId: string | number, playerId: string | number): string; /** * Converts a string to URL-safe format * * @param str - String to encode * @returns URL-encoded string * * @example * ```typescript * urlEncode('My League Name'); // "My%20League%20Name" * ``` */ export declare function urlEncode(str: string): string; /** * Builds a query string from an object * * @param params - Object with query parameters * @returns Query string (without leading ?) * * @example * ```typescript * buildQueryString({ status: 'A', sort: 'PTS' }); // "status=A&sort=PTS" * buildQueryString({ start: 0, count: 25 }); // "start=0&count=25" * ``` */ export declare function buildQueryString(params: Record): string; /** * Converts snake_case to camelCase * * @param str - String in snake_case * @returns String in camelCase * * @example * ```typescript * snakeToCamel('league_key'); // "leagueKey" * snakeToCamel('team_id'); // "teamId" * ``` */ export declare function snakeToCamel(str: string): string; /** * Converts camelCase to snake_case * * @param str - String in camelCase * @returns String in snake_case * * @example * ```typescript * camelToSnake('leagueKey'); // "league_key" * camelToSnake('teamId'); // "team_id" * ``` */ export declare function camelToSnake(str: string): string; /** * Converts an object's keys from snake_case to camelCase * * @param obj - Object with snake_case keys * @returns Object with camelCase keys * * @example * ```typescript * keysToCamel({ league_key: '423.l.12345', team_id: 1 }); * // { leagueKey: '423.l.12345', teamId: 1 } * ``` */ export declare function keysToCamel>(obj: T): Record; /** * Converts an object's keys from camelCase to snake_case * * @param obj - Object with camelCase keys * @returns Object with snake_case keys * * @example * ```typescript * keysToSnake({ leagueKey: '423.l.12345', teamId: 1 }); * // { league_key: '423.l.12345', team_id: 1 } * ``` */ export declare function keysToSnake>(obj: T): Record; //# sourceMappingURL=formatters.d.ts.map