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, 'builtins' ) ) {
		opts.builtins = options.builtins;
		if ( !isBoolean( opts.builtins ) ) {
			return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'builtins', opts.builtins ) );
		}
	}
	if ( hasOwnProp( options, 'dev' ) ) {
		opts.dev = options.dev;
		if ( !isBoolean( opts.dev ) ) {
			return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'dev', opts.dev ) );
		}
	}
	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 resolve packages
@param {boolean} [options.builtins] - boolean indicating whether to include built-in packages
@param {boolean} [options.dev] - boolean indicating whether to resolve dev dependencies
@returns {(Error|null)} error object or null

@example
var opts = {};
var options = {
    'dir': '/foo/bar/baz'
};

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