Skip to content
Snippets Groups Projects
Commit 05ea9b3c authored by Julia Friesel's avatar Julia Friesel
Browse files

Only require db when necessary

parent 9922b2e7
No related branches found
No related tags found
No related merge requests found
import * as joda from 'js-joda'
import { bleedingDaysSortedByDate as bleedingDaysSortedByDateView} from './db'
const LocalDate = joda.LocalDate
export default function config(opts = {}) {
const bleedingDaysSortedByDate = opts.bleedingDaysSortedByDate || bleedingDaysSortedByDateView
let bleedingDaysSortedByDate
if (!opts.bleedingDaysSortedByDate) {
// we only want to require (and run) the db module when not running the tests
bleedingDaysSortedByDate = require('./db').bleedingDaysSortedByDate
} else {
bleedingDaysSortedByDate = opts.bleedingDaysSortedByDate
}
const maxBreakInBleeding = opts.maxBreakInBleeding || 1
return function getCycleDayNumber(targetDateString) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment