Shorten line lengths in cycle

This commit is contained in:
Julia Friesel
2018-08-02 10:47:06 +02:00
parent 63154be24a
commit a2c428e991
2 changed files with 21 additions and 10 deletions
+4 -3
View File
@@ -28,19 +28,20 @@ export default function config(opts) {
return day
})
const firstBleedingBeforeTargetDayIndex = withWrappedDates.findIndex(day => {
// the index of the first bleeding day before the target day
const index = withWrappedDates.findIndex(day => {
return (
day.wrappedDate.isEqual(targetDate) ||
day.wrappedDate.isBefore(targetDate)
)
})
if (firstBleedingBeforeTargetDayIndex < 0) {
if (index < 0) {
withWrappedDates.forEach(day => delete day.wrappedDate)
return null
}
const prevBleedingDays = withWrappedDates.slice(firstBleedingBeforeTargetDayIndex)
const prevBleedingDays = withWrappedDates.slice(index)
const lastMensesStart = prevBleedingDays.find((day, i) => {
return noBleedingDayWithinThreshold(day, prevBleedingDays.slice(i + 1))