function *repeat(seq, times) { for(let i = 0; i < times; i++) yield *seq } function *alternate(a, delim) { for(const x of a) { yield *[x, delim] } } Object.assign(module.exports, {repeat, alternate})