Skip to content

Utility function for calculating the points of a team following a result of a match

License

Notifications You must be signed in to change notification settings

msurekci/fifa-rankings-calculator

Repository files navigation

FIFA Ranking Formula

npm version

Utility function to calculate the points of a national team based on the result.

The formula implemented is based on the documentation provided by FIFA: Documentation

Example usage

import calculatePoints, { IMPORTANCE, RESULT_SCORE } from 'fifa-ranking-formula';

calculatePoints({ 
  PBefore: 1300, 
  I: IMPORTANCE.PLAY_OFF_AND_FINAL_NATIONS_LEAGUE, 
  W: RESULT_SCORE.WIN, 
  PBeforeTeamB: 1500 
});

Options

const options = {
  PBefore: 1300 // Points of the team before at the start of the game
  I: IMPORTANCE; // Importance score of the game 
  W: RESULT_SCORE; // Result for PBefore team (1 for win, 0.75 for draw, 0.5 for loss)
  PBeforeTeamB: number; // Points of the team played against at the start of the game
  PSO?: boolean; // Did the game finish with a penalty shootout?
  KnockoutRound?: boolean; // Was it a knockout round game?
}

About

Utility function for calculating the points of a team following a result of a match

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published