Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

fifa-ranking-formula

mahmuts30ISC0.3.0TypeScript support: included

Utility function to calculate FIFA ranking points

fifa, ranking, calculate, formula, points, utility

readme

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?
}