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

@private
@param {Object} opts - destination object
@param {Options} options - function options
@param {string} [options.dir] - root directory from which to search for test files
@param {string} [options.global] - global coverage variable
@returns {(Error|null)} error object or null

@example
var opts = {};
var options = {
    'coverage': '__coverage__'
};

var err = validate( opts, options );
if ( err ) {
   throw err;
}