function validate( opts, options ) {
	if ( !isPlainObject( options ) ) {
		return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
	}
	if ( hasOwnProp( options, 'lang' ) ) {
		opts.lang = options.lang;
		if ( indexOf( LANGUAGE_CODES, opts.lang ) === -1 ) {
			return new TypeError( format( 'invalid option. `%s` option must be one of the following: "%s". Value: `%s`.', 'lang', LANGUAGE_CODES.join( '", "' ), opts.lang ) );
		}
	}
	return null;
}
Validates function options.

@private
@param {Object} opts - destination object
@param {Options} options - options to validate
@param {string} [options.lang] - language code
@returns {(null|Error)} error object or null

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