function validate( opts, options ) {
	var i;
	if ( !isObject( options ) ) {
		return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
	}
	if ( hasOwnProp( options, 'mode' ) ) {
		opts.mode = options.mode;
		if ( !isIndexMode( opts.mode ) ) {
			return new TypeError( format( 'invalid option. `%s` option must be a recognized mode. Option: `%s`.', 'mode', opts.mode ) );
		}
	}
	if ( hasOwnProp( options, 'submode' ) ) {
		opts.submode = options.submode;
		if ( !isArrayLikeObject( opts.submode ) ) {
			return new TypeError( format( 'invalid option. `%s` option must be an array containing recognized modes. Option: `%s`.', 'submode', opts.submode ) );
		}
		if ( opts.submode.length === 0 ) {
			return new TypeError( format( 'invalid option. `%s` option must be an array containing recognized modes. Option: `%s`.', 'submode', opts.submode.join( ',' ) ) );
		}
		for ( i = 0; i < opts.submode.length; i++ ) {
			if ( !isIndexMode( opts.submode[ i ] ) ) {
				return new TypeError( format( 'invalid option. Each submode must be a recognized mode. Option: `%s`.', opts.submode[ i ] ) );
			}
		}
		opts.submode = opts.submode.slice();
	}
	if ( hasOwnProp( options, 'readonly' ) ) {
		opts.readonly = options.readonly;
		if ( !isBoolean( opts.readonly ) ) {
			return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'readonly', opts.readonly ) );
		}
	}
	return null;
}
Validates function options.

@private
@param {Object} opts - destination object
@param {Options} options - function options
@param {string} [options.mode] - specifies how to handle indices which exceed array dimensions
@param {StringArray} [options.submode] - specifies how to handle subscripts which exceed array dimensions
@param {boolean} [options.readonly] - boolean indicating whether an array should be read-only
@returns {(Error|null)} null or an error object

@example
var opts = {};
var options = {
    'mode': 'clamp',
    'submode': [ 'throw', 'wrap', 'clamp' ]
};
var err = validate( opts, options );
if ( err ) {
    throw err;
}