constemptyStats='At least one completed period is needed to present you with stats here.'
constemptyStats='At least one completed cycle is needed to present you with stats here.'
if (allMensesStarts.length<2){
returnemptyStats
}else{
constcycleLengths=getCycleLength(allMensesStarts)
constnumberOfCycles=cycleLengths.length
constperiodInfo=getPeriodInfo(cycleLengths)
if (numberOfCycles===1){
return`You have documented one period of ${cycleLengths[0]} days.`
}else{
conststatsText=`Stats are based on ${numberOfCycles} completed
periods.\n\n
Average period length: ${periodInfo.mean} days\n\n
shortest period: ${periodInfo.minimum} days\n
longest period: ${periodInfo.maximum} days\n
median length (meaning 50% of periods are of this length or shorter):
${periodInfo.median} days\n
standard deviation: ${periodInfo.stdDeviation}`
returnstatsText
return`You have documented one cycle of ${cycleLengths[0]} days.`
}
constcycleInfo=getCycleInfo(cycleLengths)
conststatsText=`Stats are based on ${numberOfCycles} completed cycles.\n\n\
Average cycle length: ${cycleInfo.mean} days\n\nShortest cycle: ${cycleInfo.minimum} days\nLongest cycle: ${cycleInfo.maximum} days\nMedian length (meaning 50% of cycles are of this length or shorter): ${cycleInfo.median} days\nStandard deviation: ${cycleInfo.stdDeviation}`