{{alias}}( idx, max, mode ) Returns an index given an index mode. Parameters ---------- idx: integer Index. max: integer Maximum index value. mode: string Specifies how to handle an index outside the interval [0,max]. If equal to 'throw', the function throws an error. If equal to 'wrap', the function wraps around an index using modulo arithmetic. If equal to 'clamp', the function sets an index to either `0` (minimum index) or the maximum index. Returns ------- out: integer Index. Examples -------- > var idx = {{alias}}( 2, 10, 'throw' ) 2 > idx = {{alias}}( 2, 10, 'wrap' ) 2 > idx = {{alias}}( -4, 10, 'wrap' ) 7 > idx = {{alias}}( 13, 10, 'wrap' ) 2 > idx = {{alias}}( 2, 10, 'clamp' ) 2 > idx = {{alias}}( -4, 10, 'clamp' ) 0 > idx = {{alias}}( 13, 10, 'clamp' ) 10 See Also --------