irass-scoreboard
v1.0.1
Published
Live Football World Cup Scoreboard
Readme
Live Football World Cup Scoreboard
Live Football World Cup Scoreboard library that shows all the ongoing matches and their scores.
Installation
npm i irass-scoreboardUsage
import { Scoreboard } from "irass-scoreboard";
const scoreboard = new Scoreboard();Add a match
Adds an in progress match to the scoreboard with a default score of 0 - 0.
import { Scoreboard } from "irass-scoreboard";
const scoreboard = new Scoreboard();
const match = scoreboard.addMatch("Argentina", "France");- Teams can only have one concurrent match
Update match score
Update the score for an in progress match.
import { Scoreboard } from "irass-scoreboard";
const scoreboard = new Scoreboard();
const match = scoreboard.addMatch("Argentina", "France");
match.updateScore(1, 0);- Only one score (either home or away) can be updated at a time
- Scores can only be incremented (or decremented in case of disallowed goals) by 1
Finish a match
Remove a complete match from the scoreboard.
import { Scoreboard } from "irass-scoreboard";
const scoreboard = new Scoreboard();
const match = scoreboard.addMatch("Argentina", "France");
scoreboard.finishMatch(match);Summary
Get a summary of the in progress matches ordered by the total score (where total score is equal, most recent match is diplayed first).
import { Scoreboard } from "irass-scoreboard";
const scoreboard = new Scoreboard();
const match = scoreboard.addMatch("Argentina", "France");
match.updateScore(1, 0);
scoreboard.addMatch("Croatia", "Morocco");
console.log(scoreboard.summary());Output:
1. Argentina 1 - France 0
2. Croatia 0 - Morocco 0