fixture-creator
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

Fixture Creator

Node.js CI Publish Package to npmjs

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

Package Sidebar

Install

npm i fixture-creator

Weekly Downloads

6

Version

0.1.4

License

ISC

Unpacked Size

17.1 kB

Total Files

23

Last publish

Collaborators

  • cankatabaci