function validate( opts, options ) {
	if ( !isObject( options ) ) {
		return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
	}
	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 ) );
		}
	}
	if ( hasOwnProp( options, 'mode' ) ) {
		opts.mode = options.mode;
		if ( !isIndexMode( opts.mode ) ) {
			return new TypeError( format( 'invalid option. `%s` option must be a valid index mode. Option: `%s`.', 'mode', opts.mode ) );
		}
	}
	if ( hasOwnProp( options, 'order' ) ) {
		opts.order = options.order;
		if ( !isOrder( opts.order ) ) {
			return new TypeError( format( 'invalid option. `%s` option must be a memory layout. Option: `%s`.', 'order', opts.order ) );
		}
	}
	return null;
}
Validates function options.

@private
@param {Object} opts - destination object
@param {Options} options - function options
@param {boolean} [options.readonly] - boolean indicating whether to return a read-only vector
@param {string} [options.mode] - specifies how to handle indices which exceed vector dimensions
@param {string} [options.order] - memory layout (either row-major or column-major)
@returns {(Error|null)} null or an error object

@example
var opts = {};
var options = {
    'readonly': true
};
var err = validate( opts, options );
if ( err ) {
    throw err;
}