import Rules from './rules'; const internals = { dates: [ 'today', 'tomorrow', 'next friday', 'next wednesday', 'last thursday', 'last tuesday', 'the next day divisible by 7', 'this afternoon', 'next fiscal quarter', ], rules: [ ...Rules ], currentIndex: 0 } export const generate = async function () { const rule = internals.rules[internals.currentIndex]; const time = internals.dates[Math.floor(Math.random() * internals.dates.length)]; internals.currentIndex = (internals.currentIndex + 1) % internals.rules.length return { rule: rule(), time } }