function IteratorStream( iterator, options ) {
	var opts;
	var err;
	if ( !( this instanceof IteratorStream ) ) {
		if ( arguments.length > 1 ) {
			return new IteratorStream( iterator, options );
		}
		return new IteratorStream( iterator );
	}
	if ( !isIteratorLike( iterator ) ) {
		throw new TypeError( format( 'invalid argument. First argument must be an iterator. Value: `%s`.', iterator ) );
	}
	opts = assign( {}, DEFAULTS );
	if ( arguments.length > 1 ) {
		err = validate( opts, options );
		if ( err ) {
			throw err;
		}
	}
	// Make the stream a readable stream:
	debug( 'Creating a readable stream configured with the following options: %s.', JSON.stringify( opts ) );
	Readable.call( this, opts );

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

	// Cache whether the stream is operating in object mode:
	setNonEnumerableReadOnly( this, '_objectMode', opts.objectMode );

	// Cache the separator:
	setNonEnumerableReadOnly( this, '_sep', opts.sep );

	// Define the serialization function:
	setNonEnumerableReadOnly( this, '_serialize', opts.serialize || JSON.stringify );

	// Cache the iterator:
	setNonEnumerableReadOnly( this, '_iterator', iterator );

	// Initialize an iteration counter:
	setNonEnumerable( this, '_i', 0 );

	return this;
}
Stream constructor for generating a readable stream from an iterator.

@constructor
@param {Iterator} iterator - source iterator
@param {Options} [options] - stream options
@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 maximum number of bytes to store in an internal buffer before pausing iteration
@param {string} [options.sep='\n'] - separator used to join streamed data
@param {Function} [options.serialize] - custom serialization function
@throws {TypeError} first argument must be an iterator
@throws {TypeError} options argument must be an object
@throws {TypeError} must provide valid options
@returns {IteratorStream} Stream instance

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

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

var opts = {
    'iter': 10
};

var stream = new IteratorStream( randu( opts ) );

stream.pipe( inspectStream( log )  );