A quick and easy generator for creating fixtures.
npm install @rmshah/fixture-list-generatorfixture-list-generator will help you create meaningful fixtures for every type of competition.fixture-list-generator is fairly simple - all you need to provide is a list of names and an optional configuration and our package will handle the rest.
npm install fixture-list-generator
`2. Import the named method
generate from our package in the file where you need to generate fixtures.
`
import { generate } from 'fixture-list-generator';
`3. Provide a simple array with the names of the participants to the
generate method.
`
let teams = [
'Manchester United',
'Arsenal',
'Liverpool',
'Chelsea'
]; generate(teams);
`4. The
generate method also takes an optional second parameter for configurations. A list of configurations and their definitions are provided below.
>Currently, as of v2.0.0, you can only provide a configuration to randomise the list.
`
let config = {
randomise: false
} generate(teams, config);
`
OUTPUT
The
generate method will return two values in response:
1. participants: It will return a list of participants and the opponents it should face over the entire tournament.
2. rounds: It will return a list of all rounds and the pariticipants for every round. A sample output for the above input will look as follows:
`
{
"participants": {
"Manchester United": [
"Arsenal",
"Chelsea",
"Liverpool"
],
"Arsenal": [
"Manchester United",
"Liverpool",
"Chelsea"
],
"Liverpool": [
"Chelsea",
"Arsenal",
"Manchester United"
],
"Chelsea": [
"Liverpool",
"Manchester United",
"Arsenal"
]
},
"rounds": {
"round1": {
"players": [
{
"player1": "Arsenal",
"player2": "Manchester United"
},
{
"player1": "Liverpool",
"player2": "Chelsea"
}
]
},
"round2": {
"players": [
{
"player1": "Manchester United",
"player2": "Chelsea"
},
{
"player1": "Arsenal",
"player2": "Liverpool"
}
]
},
"round3": {
"players": [
{
"player1": "Liverpool",
"player2": "Manchester United"
},
{
"player1": "Chelsea",
"player2": "Arsenal"
}
]
}
}
}
``Configurations are useful to guide our code to give you the best results possible. Here are a list of configurations available:
> As of v2.0.0, configurations are optional.
| Configuration name | Description | Values |
| ---------- | ------ | ----- |
| randomise | It is used for randomising the list of teams provided as a parameter. It is useful for scenarios where teams need to be randomly selected and not in the order that they are provided. |
We are continuously changing and modifying our package for faster operations and better results. Keep checking this changelog for the latest changes: