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

bracket-possibilities

v1.4.0

Published

Get the best possible outcomes for a bracket based on a partially complete master bracket.

Downloads

14

Readme

bracket-possibilities

Get the best possible outcomes for a bracket based on a partially complete master bracket.

NPM Build Status js-standard-style

Install

npm install bracket-possibilities --save

API / Usage

Make a new bracket-possibilities instance with an options object (the year and sport options are required and passed directly to bracket-data):

import P from 'bracket-possibilities'

const p = new P({ sport: 'ncaam', year: '2016' })

// Hey its my entry from 2016 and the actual completed games through the Sweet 16
const entries = require('./all-entries.json')
const findEntry = ({ user }) => user.username === 'lukekarrys'
const entry = entries.find(findEntry).bracket
const master = 'S19513113721532XXXW181241131021432XXXE1954614721567XXXMW191241131015141110XXXFFXXX'

// This will return the best possible future bracket for 'entry' with any unwinnable
// games (meaning the entry has an eliminated team winning) replaced with 'X'
p.best({ entry, master })
// S195131137215321X1W181241131021432X22E19546147215671X1MW191241131015141110XXXFFSXS

// If 'entry' gets every game correct that it can, this would be its score
p.bestScrore({ entry, master })
// 1240

// This will return an array of all possible bracket combinations based on the entry's best possible
// bracket. In this instance the entry had 7 unwinnable games, so there will be 128 (2^7)
// possibilities. Warning: the more incorrect picks the longer this will take
p.possibilities({ entry, master })
// [ ... ] (128 different brackets)

// This will return the first possible winning outcome for the entry matched by `findEntry`
// Unfortunately, for me this will return null in this case because I was eliminated by the Sweet 16
p.canWin({ entries, master, findEntry })
// null or something like { rank: 1, bracket: 'SOME WINNING BRACKET' }

// This will return some of the `possibilities` where the entry matched by `findEntry`
// will finish in 1st place (tied or not)
p.winners({ entries, master, findEntry })
// [{ rank: 1,  bracket: 'OUTCOME1' }, { rank: 1, bracket: 'OUTCOME2' }, ...]

// This will return all of the `possibilities` where the entry matched by `findEntry`
// will finish in 1st place (tied or not). The difference between `winners` is that
// method will short circuit some outcomes by only trying games where the entry
// does not have an elimiated team winning
p.allWinners({ entries, master, findEntry })
// [{ rank: 1,  bracket: 'OUTCOME1' }, { rank: 1, bracket: 'OUTCOME2' }, ...]

// Find all top 5 finishes for the entry matched by `findEntry`
p.finishes({ entries, master, findEntry, rank: 5 })
// [{ rank: 3, behind: 100,  bracket: 'OUTCOME1' }, { rank: 4, behind: 120, bracket: 'OUTCOME2' }, ...]
// behind is how many points the entry would be behind the eventual winner

// Pass `scoreType` to any method involving scoring to use a different scoring
// system for the end result. Eg, find the best possible score using the gooley
// scoring system
p.bestScore({ entry, master, scoreType: 'gooley' })

LICENSE

MIT