Code coverage report for math/countSteps.js

Statements: 100% (5 / 5)      Branches: 100% (2 / 2)      Functions: 100% (3 / 3)      Lines: 100% (4 / 4)     

All files » math/ » countSteps.js
1 2 3 4 5 6 7 8 9 10 11 121         1   143   1    
define(function(){
    /**
    * Count number of full steps.
    * @version 0.2.0 (2011/10/21)
    */
    function countSteps(val, step, overflow){
        //if (val/step == 0) mod oveflow will return NaN, so ~~ converts it to 0
        return overflow? ~~(Math.floor(val / step) % overflow) : Math.floor(val / step);
    }
    return countSteps;
});