Utils.Counter Class
Implementation of a simple counter class
Item Index
Methods
Methods
makeCounter
(
Object
-
max -
now -
min
Returns a circular counter with value(), countTo(), countUp() and countDown() methods
Parameters:
-
maxNumberMaximum value of the counter
-
nowNumberInitial value to start counting from
-
minNumberMinimum value of the counter
Returns:
Object:
A counter object
Example:
import makeCounter from './utils/counter';
var counter = makeCounter(3, 1);
counter.value();
// -> 1
counter.countUp(2).value();
// -> 3
counter.countUp().value();
// -> 0
