npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cup-tool

v1.3.4

Published

Outcomes, tiebreakers and other useful tools when working with FIFA and UEFA cups and torunaments

Downloads

4

Readme

Cup Tool

Cup Tool makes it easy to calculate groups, outcomes and tiebreakers of tournaments like the UEFA Euros och FIFA World Cup.

Getting Started

Start by initializing a cup.

const cup = cupTools();

Feed it some matches:

cup.matches = [
  {
    id: "a1",
    homeTeamId: "turkey",
    awayTeamId: "italy",
    group: "A",
  },
  ...
];

Set outcomes of those matches:

cup.setOutcome("a1", {
  homeScoreFT: 0,
  awayScoreFT: 3,
});

Now you can look at the resulting groups given those outcomes.

console.log(cup.groups.A);

[
  {
    teamId: "italy",
    pld: 3,
    w: 3,
    d: 0,
    l: 0,
    gf: 7,
    ga: 1,
    gd: 6,
    pts: 9,
  },
  ...
]

Knockout stage

You can add the knockout matches with qualification criteria in the following format.

"1-A" // Winner group A
"2-A" // Runner-up group A
"1-39" // Winner KO match 39
"2-39" // Loser KO match 39

Always provide a number for knockout stage matches. Full match example:

cup.matches = [
  {
    id: "zb3s1",
    homeTeamQualify: "1-A",
    awayTeamQualify: "2-E",
    number: 39,
  },
  ...
  {
    id: "zb3s1",
    homeTeamQualify: "1-39",
    awayTeamQualify: "1-40",
    number: 56,
  },
  ...
];

After setting the outcomes, figure out which team qualified for a specific position like so:

cup.qualified("2-E")

In this case, it will return the id for the runnerup of group E.

UEFA Euros

For UEFA Euros, the best thirds of each group also proceed to KO. You need to specify which Euro ruleset to use in order for it to know what teams to match up in the KO stage. Right now, euro2016, euro2020, euro2024, olympics2024women and olympics2020women are available.

const cup = cupTools("euro2024");

Then when the outcomes are set, you can figure out which third qualified like so:

cup.qualified("3-ADEF")