Options
All
  • Public
  • Public/Protected
  • All
Menu

boxrec

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

BoxingBoutOutcomeKeys

BoxingBoutOutcomeKeys: keyof BoxingBoutOutcome

OutputValues

OutputValues: "age" | "boxingOrganizations" | "byWeightDivision" | "career" | "champions" | "commission" | "date" | "division" | "doctors" | "firstBoxerRating" | "firstBoxerWeight" | "hasBoutScheduled" | "id" | "inspector" | "judges" | "last6" | "links" | "localBoxers" | "localManagers" | "location" | "matchmakers" | "media" | "metadata" | "name" | "numberOfBouts" | "numberOfPages" | "numberOfPeople" | "numberOfRounds" | "outcome" | "people" | "points" | "promoters" | "rating" | "record" | "referee" | "residence" | "result" | "secondBoxer" | "secondBoxerLast6" | "secondBoxerRating" | "secondBoxerRecord" | "secondBoxerWeight" | "stance" | "television" | "titles"

RatingsColumns

RatingsColumns: "name" | "points" | "rating" | "age" | "career" | "w-l-d" | "stance" | "residence" | "division" | "last 6" | "ranking"

Stance

Stance: "orthodox" | "southpaw"

Variables

Const $

$: CheerioStatic = cheerio

Const profileTableEl

profileTableEl: string = ".profileTable"

Const ratingsTableEl

ratingsTableEl: string = "#ratingsResults"

Const townRegionCountryRegex

townRegionCountryRegex: RegExp = /\?country=([A-Za-z]+)(?:(?:&|&)region=([A-Za-z0-9]*))?(?:(?:&|&)town=(\d+))?/

Functions

BoutsGetter

  • BoutsGetter(tableEl: string, classType: object, theadNumber?: number, reverseOrder?: boolean): function
  • Adds a getter to the class that returns an array of bouts from an events/schedule/date table

    constructor

    Parameters

    • tableEl: string

      table element to parse bouts for

    • classType: object

      the class instance to return

    • Default value theadNumber: number = 1

      some tables the header element that contains the column data is at different points in the table

    • Default value reverseOrder: boolean = false

      if true, will reverse the order of the returned bouts

    Returns function

      • (target: any): void
      • Parameters

        • target: any

        Returns void

DateGetter

  • DateGetter(): function
  • Adds a getter to the class that returns the date column data

    constructor

    Returns function

      • (target: any): void
      • Parameters

        • target: any

        Returns void

DayGetter

  • DayGetter(): function
  • Adds a getter to the class that returns the day column and parses it

    constructor

    Returns function

      • (target: any): void
      • Parameters

        • target: any

        Returns void

DivisionGetter

  • DivisionGetter(): function
  • Adds a getter to the class that returns the division column and parses it

    constructor

    Returns function

      • (target: any): void
      • Parameters

        • target: any

        Returns void

EventsBoutsGetter

  • EventsBoutsGetter(classType: object): function
  • Adds a getter to the class that returns the events section of a table This events getter is for pages that have bouts listed underneath like you'd find on a date page, or schedule page

    constructor

    Parameters

    • classType: object

      the passed in class type that will be initialized and returned

    Returns function

      • (target: any): void
      • Parameters

        • target: any

        Returns void

FirstBoxerGetter

  • FirstBoxerGetter(): function
  • Adds a getter to the class that returns the first boxer for that table row

    constructor

    Returns function

      • (target: any): void
      • Parameters

        • target: any

        Returns void

FirstBoxerWeightGetter

  • FirstBoxerWeightGetter(returnHTML?: boolean): function
  • Adds a getter to the class that returns the weight of the first boxer

    constructor

    Parameters

    • Default value returnHTML: boolean = false

      whether to return HTML or not

    Returns function

      • (target: any): void
      • Parameters

        • target: any

        Returns void

IdGetter

  • IdGetter(commonId?: name | links): function
  • Adds a getter to the class that returns the id for that table row

    constructor

    Parameters

    • Default value commonId: name | links = BoxrecCommonTableHeader.name

    Returns function

      • (target: any): void
      • Parameters

        • target: any

        Returns void

ListingsGetter

  • ListingsGetter(getter: string, classType: object, tableEl: string): function
  • Adds a getter to the class that returns the listings of a table The getter that is added is for pages that have single listings like you'd find on a venue page, or profile pages (judges, matchmaker, etc.), location of boxers/people

    constructor

    Parameters

    • getter: string

      what the getter will be for the class

    • classType: object

      the passed in class type that will be initialized and returned

    • tableEl: string

      the table element to search data for

    Returns function

      • (target: any): void
      • Parameters

        • target: any

        Returns void

MetadataGetter

  • MetadataGetter(): function
  • Adds a getter to the class that returns the metadata for a table row (usually the row after)

    constructor

    Returns function

      • (target: any): void
      • Parameters

        • target: any

        Returns void

NumberOfRoundsGetter

  • NumberOfRoundsGetter(): function
  • Adds a getter to the class that returns the number of rounds for this bout

    constructor

    Returns function

      • (target: any): void
      • Parameters

        • target: any

        Returns void

OutcomeGetter

  • Adds a getter to the class that returns the outcome for this bout

    constructor

    Parameters

    • Default value columnHeaderText: BoxrecCommonTableHeader = BoxrecCommonTableHeader.outcome

      the column header text to search for (needs to be checked for consistency?)

    • Default value returnHTML: boolean = false

      whether to return HTML or not

    Returns function

      • (target: any): void
      • Parameters

        • target: any

        Returns void

OutputGetter

  • OutputGetter(collection: Array<string | OutputObj>): function

RatingGetter

  • RatingGetter(): function
  • Adds a getter to the class that returns the rating for this bout

    constructor

    Returns function

      • (target: any): void
      • Parameters

        • target: any

        Returns void

changeToCamelCase

  • changeToCamelCase(str: string): string
  • Changes a string to camelCase

    example

    "foo bar" becomes "fooBar"

    Parameters

    • str: string

    Returns string

convertFractionsToNumber

  • convertFractionsToNumber(fraction: string): number
  • Converts fractional symbols into decimals

    Parameters

    • fraction: string

    Returns number

getColumnDataByColumnHeader

  • getColumnDataByColumnHeader($: CheerioStatic, tableColumnsArr: string[], columnHeaderText: BoxrecCommonTableHeader, returnHTML?: boolean): string
  • Takes CheerioStatic and tries to find column data by finding the table header index and then gets that columns data Nice thing about this is that if the column number changes, the data will not fail and tests will pass Don't throw errors inside otherwise it blows up when retrieving all data

    Parameters

    • $: CheerioStatic

      the cheerio static item that will have the "mock" fake table row

    • tableColumnsArr: string[]

      contains the name of the table headers

    • columnHeaderText: BoxrecCommonTableHeader

      the header text we are searching for, throws error if it cannot find it todo make type

    • Default value returnHTML: boolean = true

    Returns string

getHeaderColumnText

  • Takes a table element, clones it and then reads the thead column text and returns an array

    Parameters

    • tableEl: Cheerio
    • Default value theadNumber: number = 1

      Some tables have more than 1 thead tag

    Returns BoxrecCommonTableHeader[]

Const getLocationValue

  • getLocationValue(href: string, type: "town" | "region" | "country"): string | number | null
  • Parameters

    • href: string
    • type: "town" | "region" | "country"

    Returns string | number | null

getTableColumnData

  • getTableColumnData(tableEl: Cheerio, columnNumber?: number, returnHTML?: boolean): string[]
  • Returns an array of all row data from a specific column

    Parameters

    • tableEl: Cheerio

      the table element to check from

    • Default value columnNumber: number = 1

      the column number to get the data

    • Default value returnHTML: boolean = false

      optionally return the full HTML of the column

    Returns string[]

getValueForHeadersArr

Const parseHeight

  • parseHeight(height: string | void): number[] | null
  • Parameters

    • height: string | void

    Returns number[] | null

Const replaceWithWeight

  • replaceWithWeight(str: string): string

Const stripArrows

  • stripArrows(str: string): string
  • Strips the dataTable arrows from table headers

    Parameters

    • str: string

    Returns string

Const stripCommas

  • stripCommas(str: string): string
  • Strips the commas out of a string. Used for strings that are large numbers

    Parameters

    • str: string

    Returns string

trimRemoveLineBreaks

  • trimRemoveLineBreaks(str: string): string
  • Removes whitespace at the start and end of the string, remove line breaks and removes occurrences where multiple spaces occur

    Parameters

    • str: string

    Returns string

Const whatTypeOfLink

  • whatTypeOfLink(href: string): "town" | "region" | "country"
  • Parameters

    • href: string

    Returns "town" | "region" | "country"

Object literals

Const beltOrganizations

beltOrganizations: object

BoxRec

BoxRec: null = null

IBF

IBF: null = null

IBO

IBO: null = null

WBA

WBA: null = null

WBC

WBC: null = null

WBO

WBO: null = null

Const emptyLocationObject

emptyLocationObject: object

location

location: object

country

country: object

id

id: null = null

name

name: null = null

region

region: object

id

id: null = null

name

name: null = null

town

town: object

id

id: null = null

name

name: null = null

venue

venue: object

id

id: null = null

name

name: null = null

Const weightDivisions

weightDivisions: object

bantamweight

bantamweight: BoxrecBelts = beltOrganizations

cruiserweight

cruiserweight: BoxrecBelts = beltOrganizations

featherWeight

featherWeight: BoxrecBelts = beltOrganizations

flyweight

flyweight: BoxrecBelts = beltOrganizations

heavyweight

heavyweight: BoxrecBelts = beltOrganizations

lightFlyweight

lightFlyweight: BoxrecBelts = beltOrganizations

lightHeavyweight

lightHeavyweight: BoxrecBelts = beltOrganizations

lightweight

lightweight: BoxrecBelts = beltOrganizations

middleweight

middleweight: BoxrecBelts = beltOrganizations

minimumweight

minimumweight: BoxrecBelts = beltOrganizations

superBantamweight

superBantamweight: BoxrecBelts = beltOrganizations

superFeatherweight

superFeatherweight: BoxrecBelts = beltOrganizations

superFlyweight

superFlyweight: BoxrecBelts = beltOrganizations

superLightweight

superLightweight: BoxrecBelts = beltOrganizations

superMiddleweight

superMiddleweight: BoxrecBelts = beltOrganizations

superWelterweight

superWelterweight: BoxrecBelts = beltOrganizations

welterweight

welterweight: BoxrecBelts = beltOrganizations

Generated using TypeDoc