Version 2
π― Major Rewrite: Functional API
v2.0.0 introduces a complete rewrite with a functional API that replaces the previous class-based approach.
β¨ New Features
- Simple function calls replace multi-step class setup
- Strong TypeScript typing enforces minimum 2 teams at compile time
- Pure functions for better testing and functional programming patterns
- Multi-team matches with dedicated
calculateMultiTeamMatch()function
π₯ Breaking Changes
- Classes removed:
Duel,FreeForAll,TeamMatch,Playerclasses β replaced with functions - API simplified:
calculateDuel(),calculateFreeForAll(),calculateTeamMatch() - Player objects:
new Player(id, rating)β{ id, rating }plain objects - Team scoring:
rankparameter βscoreparameter (higher score = better performance) - Expected score:
player.expectedScoreAgainst()βcalculateExpectedScore()function
π¦ Migration
See MIGRATION_v2.md for detailed migration examples.
Before (v1):
const match = new Duel();
match.addPlayer(new Player("p1", 1200), true);
match.addPlayer(new Player("p2", 1320), false);
const results = match.calculate();After (v2):
const results = calculateDuel(
{ id: "p1", rating: 1200 }, // winner
{ id: "p2", rating: 1320 } // loser
);Full Changelog: v1...v2.0.0