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

@private
@param {Object} opts - destination object
@param {Options} options - function options
@param {NonNegativeInteger} [options.port] - server port
@param {NonNegativeInteger} [options.maxport] - max server port
@param {string} [options.hostname] - server hostname
@param {string} [options.address] - server address
@returns {(Error|null)} error or null

@example
var options = {
    'port': 7331,
    'address': '127.0.0.1'
};
var opts = {};
var err = validate( opts, options );
if ( err ) {
    throw err;
}