countSteps.js 266 B

12345678910111213141516
  1. /**
  2. * Count number of full steps.
  3. */
  4. function countSteps(val, step, overflow){
  5. val = Math.floor(val / step);
  6. if (overflow) {
  7. return val % overflow;
  8. }
  9. return val;
  10. }
  11. module.exports = countSteps;