
{{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 'normalize', the
        function throws an error if provided an out-of-bounds normalized index.
        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
    > idx = {{alias}}( 2, 10, 'normalize' )
    2
    > idx = {{alias}}( -4, 10, 'normalize' )
    7


{{alias}}.factory( mode )
    Returns a function for returning an index according to a provided index
    mode.

    The function returns a function which accepts the following arguments:

    - idx: index.
    - max: maximum index value.

    Parameters
    ----------
    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 'normalize', the
        function throws an error if provided an out-of-bounds normalized index.
        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
    -------
    fcn: Function
        Function for returning an index.

    Examples
    --------
    > var f = {{alias}}.factory( 'clamp' );
    > var idx = f( 2, 10 )
    2
    > idx = f( -4, 10 )
    0
    > idx = f( 13, 10 )
    10

    See Also
    --------

