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

bracket-validator

v3.1.1

Published

Validate a tournament bracket.

Downloads

71

Readme

bracket-validator

Validate a tournament bracket.

NPM Build Status Greenkeeper badge

To see the data this repo is built on, check out bracket-data.

What is this?

bracket-validator is a module that takes a string representation of a bracket and validates it against the real data for that bracket's sport and year.

The main use case for this is to validate a user's entry against the actual data in order to score it or display it showing correct/incorrect picks. There are other modules which rely on bracket-validator such as bracket-scorer and bracket-updater.

API / Usage

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

var BracketValidator = require('bracket-validator');
var validator = new BracketValidator({
   year: '2013',
   sport: 'ncaam',
   /* User bracket string */
   flatBracket: 'MW1812463XXXXXXXXXW19XX614XXXXXXXXXSXX54XXXXXXXXXXXEXX12463XXXXXXXXXFFXXX'
});
console.log(validator.validate());

options

  • sport: The sport you are validating. See bracket-data for more info.
  • year: The year you are validating. See bracket-data for more info.
  • testOnly: (Boolean, default: false) Whether to only test the validation and not return an expanded bracket
  • allowEmpty: (Boolean, default: true) Whether the validation should allow unpicked matches. This is useful for validating a bracket as a user is selecting it.
  • flatBracket: (String, default: '') The user's bracket to validate

methods

  • validate(flatBracket): Validate the bracket. The param flatBracket is optional here. If you pass it in, it will call reset first and then validate, otherwise it will use the option it was instantiated with. It will return one of the following:
    • An Error with the message set to why the validation failed
    • The flatBracket if validation is successfull and testOnly is set to true
    • An expanded bracket object created from flatBracket if validation is successful. It will have each region containing a multidimensional array: rounds. This is ordered by round and picks, where if a pick is made it will contain the team seed and name and if a pick is not made it will be null.
  • reset(flatBracket): Reset the validator to use a new flatBracket.

Anything else?

If this is interesting to you, I think you should follow me (@lukekarrys) and @tweetthebracket on Twitter. There are also a lot of other bracket related modules on our GitHub organization page.