1.7.3 • Published 8 days ago

resolve-team v1.7.3

Weekly downloads
-
License
MIT
Repository
-
Last release
8 days ago

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

ParameterTypeDescription
teamstringThe team name or abbreviation to search.
optionsobject(Optional) Configures the search and returned data

Options

Customization options available:

PropertyTypeDefaultDescription
sportstring'all'Specific sport category (e.g., 'nba', 'nfl').
thresholdnumber0.4Search sensitivity (0-1). Lower values are stricter.
fullbooleanfalseIf 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

1.7.3

8 days ago

1.7.2

9 days ago

1.7.1

9 days ago

1.7.0

9 days ago

1.6.0

4 months ago

1.2.0

4 months ago

1.2.8

4 months ago

1.4.5

4 months ago

1.2.7

4 months ago

1.4.4

4 months ago

1.2.6

4 months ago

1.4.3

4 months ago

1.2.5

4 months ago

1.5.1

4 months ago

1.4.2

4 months ago

1.2.4

4 months ago

1.5.0

4 months ago

1.4.1

4 months ago

1.2.3

4 months ago

1.4.0

4 months ago

1.3.1

4 months ago

1.3.0

4 months ago

1.2.1

4 months ago

1.2.9

4 months ago

1.1.1

8 months ago

1.1.0

8 months ago

1.0.1

9 months ago

1.0.0

9 months ago

0.0.1

9 months ago