Cycle through the contents of an array. By default starts at index 0.
const c = arrayCycle([`apples`, `oranges`, `pears`]);c.current; // `apples`c.next(); // `oranges`c.next(); // `pears`c.next(); // `apples`c.prev(); // `pears` Copy
const c = arrayCycle([`apples`, `oranges`, `pears`]);c.current; // `apples`c.next(); // `oranges`c.next(); // `pears`c.next(); // `apples`c.prev(); // `pears`
You can select an item by index or value:
c.select(1); // `oranges`c.select(`pears`); // `pears` Copy
c.select(1); // `oranges`c.select(`pears`); // `pears`
Other features:
c.current; // Current valuec.toArray(); // Copy of array being cycled over Copy
c.current; // Current valuec.toArray(); // Copy of array being cycled over
Additional info:
Array to cycle over
Cycle through the contents of an array. By default starts at index 0.
You can select an item by index or value:
Other features:
Additional info: