@eaton Sorry, couldn’t help myself to write it as a generator function (which return iterators with a .next method):
function * makeRotator (items) {
let i = 0
while (true) {
yield items[i % items.length]
i++
}
}
but yeah, not sure it’s worth the complexity…