fixture-creator
v0.1.4
Published
Round-robin tournament based sports fixture creator
Downloads
175
Maintainers
Readme
Fixture Creator
Round-robin tournament based sports fixture creator
Install
npm i fixture-creator
Usage
import { FixtureCreator } from "fixture-creator";
const teams:string[] = ['Barcelona', 'Bayern Munich', 'Galatasaray'];
const fixtureCreator = new FixtureCreator();
console.log(fixtureCreator.createLeagueFixture(teams));
teams
should be a array of team names as a string
teams
must have at least 2 team
if teams
length is odd, the team that will not play that week is shown to face 'BYE-THIS-WEEK'
. If you prefer dash(-
) instead of this text, you have to write false after team string
console.log(fixtureCreator.createLeagueFixture(teams, false));
fixtureCreator.createLeagueFixture(teams)
returns fixture object. fixture object contains game weeks array.
{
"weeks":[
{
"title":"1. Match Week",
"matches":[
{
"home":"Galatasaray",
"away":"Barcelona"
},
{
"home":"Bayern Munich",
"away":"BYE-THIS-WEEK"
}
]
},
{
"title":"2. Match Week",
"matches":[
{
"home":"Galatasaray",
"away":"BYE-THIS-WEEK"
},
{
"home":"Barcelona",
"away":"Bayern Munich"
}
]
},
{
...
...
}
]
}
Notes
I developed this package to use in FIFA(FC) tournaments that we play with our friends. We play our FIFA tournament like a classic league so it creates(by default) a fixture that includes the return matches. demo