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, 'flags' ) ) {
		opts.flags = options.flags;
		if ( !isString( opts.flags ) ) {
			return new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'flags', opts.flags ) );
		}
	}
	if ( hasOwnProp( options, 'capture' ) ) {
		opts.capture = options.capture;
		if ( !isBoolean( opts.capture ) ) {
			return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'capture', opts.capture ) );
		}
	}
	return null;
}
Validates function options.

@private
@param {Object} opts - destination object
@param {Options} options - function options
@param {string} [options.flags] - regular expression flags
@param {boolean} [options.capture] - boolean indicating whether to wrap a regular expression matching a decimal number with a capture group
@returns {(Error|null)} null or an error object

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