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

resolve-team

v1.7.3

Published

Resolve NBA & NFL sports team names and information via fuzzy search

Downloads

312

Readme

NPM Downloads npm version


Contents

Overview

Resolve Team is a lightweight, easy-to-use library that effortlessly identifies sports teams based on partial input, misspelled, or full names, making basic team data available instantly. Utilizing Fuse.js, it provides a powerful fuzzy search functionality for resolving sports team names, the best and only library to do this.


Installation

To integrate Resolve Team into your project, you can install it via npm:

Via npm

npm install resolve-team

Via yarn

yarn add resolve-team

Usage

After installation, you can use the library to resolve sports team names by importing the resolveTeam function.

Parameters

| Parameter | Type | Description | |-----------|--------|----------------------------------------------------| | team | string | The team name or abbreviation to search. | | options | object | (Optional) Configures the search and returned data |

Options

Customization options available:

| Property | Type | Default | Description | |-----------|---------|---------|-------------------------------------------------------| | sport | string | 'all' | Specific sport category (e.g., 'nba', 'nfl'). | | threshold | number | 0.4 | Search sensitivity (0-1). Lower values are stricter. | | full | boolean | false | If true, returns the complete team object. |

Team API Reference

Team Interface - This is provided when you use the full option from the library.

interface Team {
  name: string
  colors: string[]
  nicknames: string[]
  abbrev: string[]
}

Examples

Basic usage and examples of the resolveTeam function:

import { resolveTeam } from 'resolve-team'

// Standard usage, resolves the team name directly.
const nbaTeam = resolveTeam(`Bos`) // 'Boston Celtics'

// Fuzzy search example
const nflTeam = resolveTeam('gia') // 'New York Giants'

// Retrieving the full team object
const fullTeam = resolveTeam('celtics', { full: true })
/**
 * Resolves with the complete team object:
	{
	    name: 'Boston Celtics',
	    colors: ['#007A33', '#BA9653', '#000000'],
	    nicknames: ['celtics', 'boston', 'bos', 'celt'],
	    abbrev: ['BOS'],
	}
 */

// Limit search to a specific sport
const nbaTeam2 = resolveTeam('nyk', { sport: 'nba' }) // 'New York Knicks'

Contributing

Contributions are welcome and greatly appreciated! Please make a PR or open an issue. I'd love to expand the library to include more sports, teams, nicknmaes, etc.

Authors

License

This project is licensed under the MIT License—see the LICENSE file for details.

Back To The Top