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 🙏

© 2026 – Pkg Stats / Ryan Hefner

qpjs

v0.0.5

Published

Very silly library to tell who wins on a two-legged knockout series

Readme

qpjs

Quien Pasa? - JS. A very silly library to tell who wins on two-legged knockout series

Why doing this?

Short answer: just for fun.

Long answer: at SCV we love fútbol. We were having arguments on a Copa Libertadores knockout leg about who will pass to the next stage considering the slightly convoluted system they have. One of us mentioned it would be nice to have an app for it. So this library would be useful for that.

Another (and maybe slightly more important) reason was this was a good excuse to do a super simple example on how to publish an npm module with all the niceties for a good dev environment (ES6, tests, linter)

Installation

npm install qpjs

Usage

var qp = require('qpjs');

data = {
  teams: ['Blues', 'Reds'],
  games: [
    { home: 2, away: 1 }
    { home: 3, away: 2 }
  ]
};

options = {
  fullResult: false,
  awayGoalsRule: true
}

result = qp(data, options);
console.log(result); // "Blues"

This will return who would win on a two legged knockout stage according to data, Where:

  • data is a plain javascript object with teams and games

    • teams is an array with two strings with the names of the two teams. The first team is the one that is the home team in the first game. If not given, it defaults to Team 1 and Team 2
    • games is an array with the results of the two games. Each result is a plain javascript object with a home and an away property
  • options is a plain javascript object with options. It can be ommited as all options have defaults. Currently the following options are supported

    • fullResult: defaults to true. If true, the result is returned as an object with both the winner (can be undefined in case of a tie) and the reason. If false only a simple string with the winner name is returned (or undefined in case of a tie)
    • awayGoalsRule: defaults to true. If true, away goals are taking into account in case of a tie in aggregate goals
  • When fullResult is true, reason can take the following values:

    • AGGREGATE: winner just have more goals in aggregate
    • AWAY_GOALS: there is a tie on aggregate goals, but winner has more away goals
    • FULL_TIE: teams are tied on both aggregate goals and away goals
    • TIE: teams are tied on aggregate goals and away goals rule is not applied on this case

Refer to the tests for more usage examples.