function JoinStream( options ) {
	var opts;
	var err;
	if ( !( this instanceof JoinStream ) ) {
		if ( arguments.length ) {
			return new JoinStream( options );
		}
		return new JoinStream();
	}
	opts = defaults();
	if ( arguments.length ) {
		err = validate( opts, options );
		if ( err ) {
			throw err;
		}
	}
	// The stream's writable state should always be in object mode to prevent incoming data from being buffered (concatenated) and thus lose separation...
	opts.writableObjectMode = true;

	// The stream converts each chunk into a string so no need to encode strings written to the join stream as Buffer objects:
	opts.decodeStrings = false;

	// Make the stream a Transform stream:
	debug( 'Creating a transform stream configured with the following options: %s.', JSON.stringify( opts ) );
	Transform.call( this, opts );

	// Destruction state:
	setNonEnumerable( this, '_destroyed', false );

	// Cache the encoding:
	setNonEnumerableReadOnly( this, '_encoding', ( opts.encoding === null ) ? 'utf8' : opts.encoding );

	// Cache the separator:
	if ( this._encoding !== 'utf8' ) {
		opts.sep = string2buffer( opts.sep, this._encoding );
	}
	setNonEnumerableReadOnly( this, '_sep', opts.sep );

	// Flag indicating if the stream has received streamed data:
	setNonEnumerable( this, '_init', false );

	// Chunk counter:
	setNonEnumerable( this, '_idx', -1 );

	return this;
}
Join stream constructor.

@constructor
@param {Options} [options] - stream options
@param {string} [options.sep='\n'] - separator used to join streamed data
@param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode
@param {(string|null)} [options.encoding=null] - 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=false] - specifies whether the stream should remain open even if one side ends
@param {boolean} [options.readableObjectMode=false] - specifies whether the readable side should be in object mode
@throws {TypeError} options argument must be an object
@throws {TypeError} must provide valid options
@returns {JoinStream} join stream

@example
var inspectStream = require( '@stdlib/streams/node/inspect-sink' );

function log( chunk ) {
   console.log( chunk );
}

var stream = new JoinStream();

stream.pipe( inspectStream( log )  );

stream.write( '1' );
stream.write( '2' );
stream.write( '3' );

stream.end();

// prints: '1\n2\n3'