0.1.1 • Published 2 years ago

fixture-creator v0.1.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

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 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.

0.1.0

2 years ago

0.1.1

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago