team-finder
v2.3.3
Published
Finds NHL teams based on given text
Downloads
17
Maintainers
Readme
team-finder
Finds NHL teams that match the given term.
Install
$ npm install team-finder
Usage
import { findTeam } from 'team-finder'
findTeam('Capitals').fullName // 'Washington Capitals'
API
findTeam
Returns a Team if a team is found, or null if not
import { findTeam } from 'team-finder'
findTeam('Washington').teamName // 'Capitals'
findTeam('Capitals').cityName // 'Washington'
findTeam('WSH').fullName // 'Washington Capitals'
findTeam('Caps').abbreviation // 'WSH'
// Case insensitive
findTeam('washington', { caseSensitive: false }).teamName // 'Capitals'
findTeam('wsh', {
caseSensitive: {
abbreviation: false,
teamName: true
cityName: true
}
}).teamName // 'Capitals'
// Elliotte Friedman mode for his stubborn use of wrong abbreviations
findTeam('CAL', { friedman: true }).abbreviation // 'CGY'
teams
Returns an object containing all teams with abbreviations as the key
import { teams } from 'team-finder'
teams.ANA.cityName // 'Anaheim'
teams.BOS.fullName // 'Boston Bruins'
teamDictionary
An object where the keys are the terms/names/social media values, and the values are team abbreviations. findTeam
used to use this under the hood. Will probably be removed in a later major version (3.x).
(note: this does not include friedmanAbbreviations
of teams)
import { teamDictionary } from 'team-finder'
teamDictionary['Caps'] // 'WSH'
teamDictionary['@FlaPanthers'] // 'FLA'