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, 'sep' ) ) {
		opts.sep = options.sep;
		if (
			!isString( opts.sep ) &&
			!isRegExp( opts.sep )
		) {
			return new TypeError( format( 'invalid option. `%s` option must be either a string or a regular expression. Option: `%s`.', 'sep', opts.sep ) );
		}
	}
	if ( hasOwnProp( options, 'objectMode' ) ) {
		opts.objectMode = options.objectMode;
		if ( !isBoolean( opts.objectMode ) ) {
			return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'objectMode', opts.objectMode ) );
		}
	}
	if ( hasOwnProp( options, 'writableObjectMode' ) ) {
		opts.writableObjectMode = options.writableObjectMode;
		if ( !isBoolean( opts.writableObjectMode ) ) {
			return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'writableObjectMode', opts.writableObjectMode ) );
		}
	}
	if ( hasOwnProp( options, 'encoding' ) ) {
		opts.encoding = options.encoding;
		if ( !isString( opts.encoding ) ) {
			return new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'encoding', opts.encoding ) );
		}
	}
	if ( hasOwnProp( options, 'allowHalfOpen' ) ) {
		opts.allowHalfOpen = options.allowHalfOpen;
		if ( !isBoolean( opts.allowHalfOpen ) ) {
			return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'allowHalfOpen', opts.allowHalfOpen ) );
		}
	}
	if ( hasOwnProp( options, 'highWaterMark' ) ) {
		opts.highWaterMark = options.highWaterMark;
		if ( !isNonNegative( opts.highWaterMark ) ) {
			return new TypeError( format( 'invalid option. `%s` option must be a nonnegative number. Option: `%s`.', 'highWaterMark', opts.highWaterMark ) );
		}
	}
	return null;
}
Validates function options.

@private
@param {Object} opts - destination object
@param {Options} options - function options
@param {(string|RegExp)} [options.sep] - separator used to split streamed data
@param {boolean} [options.objectMode] - specifies whether stream should operate in object mode
@param {(string|null)} [options.encoding] - specifies how `Buffer` objects should be decoded to `strings`
@param {NonNegativeNumber} [options.highWaterMark] - specifies the `Buffer` level for when `write()` starts returning `false`
@param {boolean} [options.allowHalfOpen] - specifies whether the stream should remain open even if one side ends
@param {boolean} [options.writableObjectMode] - specifies whether the writable side should be in object mode
@returns {(Error|null)} null or an error object

@example
var opts = {};
var options = {
    'sep': '\t',
    'objectMode': true
};
var err = validate( opts, options );
if ( err ) {
    throw err;
}