Skip to content

Instantly share code, notes, and snippets.

@kanian
Created May 21, 2019 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kanian/8784a7c67080d6a59369287e09c83b05 to your computer and use it in GitHub Desktop.
Save kanian/8784a7c67080d6a59369287e09c83b05 to your computer and use it in GitHub Desktop.
function cycle(...args) {
let [x,y] = [...args]
let els = Array.isArray(x) ? x : typeof y === 'undefined' ? [x] : [...filler(x,y)]
let index = 0;
return {
next: function() {
if (index === els.length)
index = 0;
return { value: els[index++], done: false };
}
};
}
function cycleThroughNumberPattern(x,y, n) {
return take(n, cycle(x,y));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment