sjl.js
function wrapPointer (pointer, min, max) {
        return pointer > max ? min : (pointer < min ? max : pointer);
    }
function wrapPointer (pointer, min, max) {
        return pointer > max ? min : (pointer < min ? max : pointer);
    }
function wrapPointer ( pointer , min , max ) { return pointer > max ? min : ( pointer < min ? max : pointer ) ; }
Wraps a pointer (number) around a bounds (range of two numbers) or returns the next valid pointer depending
on direction:  E.g.,
If pointer is less than `min` then returns `max`.  If pointer is greater than `max` returns `min`.
If pointer is within bounds then returns `pointer`.
@function module:sjl.wrapPointer
@param pointer {Number}
@param min {Number}
@param max {Number}
@returns {Number}
Wraps a pointer ( number ) around a bounds ( range of two numbers ) or returns the next valid pointer depending on direction : E . g . If pointer is less than min then returns max . If pointer is greater than max returns min . If pointer is within bounds then returns pointer .