Restricts an index to the interval [0,max].
[0,max]
index
maximum index
var idx = clampIndex( -1, 10 ); // returns 0 idx = clampIndex( 15, 10 ); // returns 10 idx = clampIndex( 5, 10 ); // returns 5
Restricts an index to the interval
[0,max]
.