utils/common

utils/common

Members

(static, constant) exports.calulatePlacedSelection

Source:

Changing color of placed bet depend on winning or losing bet

Methods

(static) compare(x, y) → {number}

Source:

Compare 2 numbers. Return 1 if first is bigger then second. Retun 0 if numbers are equal. Return -1 if second is bigger then first.

Parameters:
Name Type Description
x number
y number
Returns:
Type
number

(static) exports.addToPlacedBetsRecord(placedBetRecordsArr, recordsParams) → {Array}

Source:

addToPlacedBetsRecord

Parameters:
Name Type Description
placedBetRecordsArr Array
recordsParams object
Returns:

Return array with new placed bet records

Type
Array

(static) exports.computeLoader(style) → {object}

Source:

Calculate angle of loader for no bet coundown

Parameters:
Name Type Description
style object
Returns:
Type
object

(static) exports.convertIntoCents(amount) → {boolean}

Source:

Convert amount into cents

Parameters:
Name Type Description
amount number
Returns:
Type
boolean

(static) exports.convertIntoUnits(amount) → {boolean}

Source:

Convert amount from cents to units (Naira)

Parameters:
Name Type Description
amount number
Returns:
Type
boolean

(static) exports.delay(time) → {Promise}

Source:

Provide setTimeout delay

Parameters:
Name Type Description
time number

Delay time

Returns:
Type
Promise

(static) exports.extractWinningScores(market, selectionId) → {string}

Source:

Extract WinningScores

Parameters:
Name Type Description
market object
selectionId number
Returns:
Type
string

(static) exports.filterDuplicateSelections(selectedOdds) → {Array}

Source:

reduce selected odds that have same matchId and same league

Parameters:
Name Type Description
selectedOdds Array
Returns:
Type
Array

(static) exports.filterSelectedOdds(selectedOdds, roundId) → {Array}

Source:

Get filtered selected odds by roundId

Parameters:
Name Type Description
selectedOdds Array
roundId number
Returns:
Type
Array

(static) exports.getCountryDateFromUTC(countryOffset, date) → {string}

Source:

get javascript date object in country time from utc time

Example
2020-04-27T09:18:02Z
parsed to   "27/04/2020 09:18:02"
Parameters:
Name Type Description
countryOffset string
date Time
Returns:

Parsed date and time

Type
string

(static) exports.getCountryDateTime(dateString) → {string}

Source:

Parse date in format DD/MM/YYYY, time in format hh:mm:ss with selected country time zone

Example
2020-04-27T09:18:02Z
parsed to   "27/04/2020 09:18:02"
Parameters:
Name Type Description
dateString Time
Returns:

Parsed date and time

Type
string

(static) exports.getCountryNewDate(country, date) → {string}

Source:

get javascript date object in nigeria time

Parameters:
Name Type Description
country string
date Time
Returns:

Parsed date and time

Type
string

(static) exports.getSelection(market, index) → {string}

Source:

Find selection in passed market by selection id

Parameters:
Name Type Description
market object
index number
Returns:
Type
string

(static) exports.getSelectionName(selectionIndex, markets) → {string}

Source:

Find selection in all markets by selection id

Parameters:
Name Type Description
selectionIndex number
markets Array
Returns:
Type
string

(static) exports.getSelectionNames(placedSelections, leagueId, matchId) → {string}

Source:

Find selection in passed market by selection id

Parameters:
Name Type Description
placedSelections object
leagueId number
matchId number
Returns:
Type
string

(static) exports.getTicketOdds(ticket) → {string}

Source:

Parse minimum and maximum odds for passed bet type

Parameters:
Name Type Description
ticket object
Returns:
Type
string

(static) exports.getTimeFormat(diffSec) → {string}

Source:

Parse time

Parameters:
Name Type Description
diffSec Time
Returns:

Return parsed minutes and seconds MM:SS

Type
string

(static) exports.getTimeTextFormat(diffSec) → {string}

Source:

Parse time

Parameters:
Name Type Description
diffSec Time
Returns:

Return template minutes and seconds

Type
string

(static) exports.handleType(ticket) → {string}

Source:

Return bet type based on typeID

Parameters:
Name Type Description
ticket object
Returns:
Type
string

(static) exports.isCombi(type) → {boolean}

Source:

Check if typeID is some of combination bet types

Parameters:
Name Type Description
type number
Returns:
Type
boolean

(static) exports.isLivePage(currentPage) → {boolean}

Source:

Check if it is some of LIVE pages

Parameters:
Name Type Description
currentPage string
Returns:
Type
boolean

(static) exports.isSingleMultipleBet(ticket) → {boolean}

Source:

Check if typeID is single with multiple bet

Parameters:
Name Type Description
ticket number
Returns:
Type
boolean

(static) exports.isTicketPage(targetPage) → {boolean}

Source:

Check if it is some of TICKET pages

Parameters:
Name Type Description
targetPage string
Returns:
Type
boolean

(static) exports.newObjectRef(obj) → {object}

Source:

Create colne of object with different reference

Parameters:
Name Type Description
obj object
Returns:
Type
object

(static) exports.openLiveStartedModal(targetPage) → {boolean}

Source:

Check if it is not some of RESULT or TICKET pages

Parameters:
Name Type Description
targetPage string
Returns:
Type
boolean

(static) exports.parseCouponData(betType, selections, stake) → {object}

Source:

parseCouponData

Parameters:
Name Type Description
betType number
selections string
stake string
Returns:

Coupon data

Type
object

(static) exports.reCountPlacedBetsRecord(placedBetRecords) → {number}

Source:

reCountPlacedBetsRecord

Parameters:
Name Type Description
placedBetRecords object
Returns:

Return updated placed bet records and updated counter

Type
number

(static) exports.remapMarketsToSelectionWinningScores(markets) → {object}

Source:

remapMarketsToSelectionWinningScores

Parameters:
Name Type Description
markets Array
Returns:

Map (selection, WinningScores)

Type
object

(static) exports.removeListener() → {void}

Source:

Remove scroll listener from scroll area

Returns:
Type
void

(static) exports.roundSetupTimers(endDate, liveStartDate, liveMatchDuration, noBettingTimeCountdown) → {object}

Source:

Calculate : oldData [ when round end is in the past ], haveLiveMatches [ when live is started and still not ended ], isNoBetTime [ live is started in less then noBettingTimeCountdown seconds ], leftTime [ left seconds till live start ]

Parameters:
Name Type Description
endDate Time
liveStartDate Time
liveMatchDuration number
noBettingTimeCountdown number
Returns:
Type
object

(static) exports.setDefaultStakesArr(selectedOdds) → {Array}

Source:

Get default stakes array

Parameters:
Name Type Description
selectedOdds Array
Returns:
Type
Array

(static) exports.setupCalc(calc, stake, bonusOddMax, bonusOddMin, numOfBets, manager) → {object}

Source:

Calculate total stake, potential win (max and min) and bonus amount

Parameters:
Name Type Description
calc object

Previous calculation

stake number
bonusOddMax number
bonusOddMin number
numOfBets number | null
manager object
Returns:
Type
object

(static) exports.setupCounter(roundEnd, live, liveMatchDuration, noBettingTimeCountdown) → {object}

Source:

Calculate game timers for betting round and live round

Parameters:
Name Type Description
roundEnd Time
live Time
liveMatchDuration number
noBettingTimeCountdown number
Returns:

Return seconds to end betting round and seconds to end live game

Type
object

(static) exports.sortByAwayScores(a, b) → {number}

Source:

Compare away scores

Parameters:
Name Type Description
a number
b number
Returns:
Type
number

(static) exports.sortByAwayThenHomeScores(a, b) → {number}

Source:

Compare away scores then home scores

Parameters:
Name Type Description
a number
b number
Returns:
Type
number

(static) exports.sortByHomeScores(a, b) → {number}

Source:

Compare home scores

Parameters:
Name Type Description
a number
b number
Returns:
Type
number

(static) exports.sortByHomeThenAwayScores(a, b) → {number}

Source:

Compare home scores then away scores

Parameters:
Name Type Description
a number
b number
Returns:
Type
number

(static) exports.sortFreeBets(freeBets) → {Array}

Source:

Sort free bets by expiration date

Parameters:
Name Type Description
freeBets Array
Returns:
Type
Array

(static) exports.transformStandingsPerTeam(standings) → {object}

Source:

transform api standings object to map per team

Parameters:
Name Type Description
standings string
Returns:
Type
object

(static) exports.transformStatisticsPerTeamLast5(weeksStatistics) → {object}

Source:

transform api statistics object to map per team

Parameters:
Name Type Description
weeksStatistics Array
Returns:
Type
object

(static) exports.updateBetCounter(placedBetRecordsArr) → {number}

Source:

updateBetCounter

Parameters:
Name Type Description
placedBetRecordsArr Array
Returns:

Return updated counter

Type
number