fifa-ranking-formula
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

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

Package Sidebar

Install

npm i fifa-ranking-formula

Weekly Downloads

0

Version

0.3.0

License

ISC

Unpacked Size

5.67 kB

Total Files

5

Last publish

Collaborators

  • mahmuts