function iterUniqueByHash( iterator, hashFcn, thisArg ) {
	var iter;
	var hash;
	var FLG;
	if ( !isIteratorLike( iterator ) ) {
		throw new TypeError( format( 'invalid argument. First argument must be an iterator protocol-compliant object. Value: `%s`.', iterator ) );
	}
	if ( !isFunction( hashFcn ) ) {
		throw new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', hashFcn ) );
	}
	hash = [];

	// Create an iterator protocol-compliant object:
	iter = {};
	setReadOnly( iter, 'next', next );
	setReadOnly( iter, 'return', end );

	// If an environment supports `Symbol.iterator`, make the iterator iterable:
	if ( iteratorSymbol && isFunction( iterator[ iteratorSymbol ] ) ) {
		setReadOnly( iter, iteratorSymbol, factory );
	}
	return iter;

	/**
	* Returns an iterator protocol-compliant object containing the next iterated value.
	*
	* @private
	* @returns {Object} iterator protocol-compliant object
	*/
	function next() {
		var hv;
		var v;
		if ( FLG ) {
			return {
				'done': true
			};
		}
		while ( true ) {
			v = iterator.next();
			if ( v.done ) {
				FLG = true;
				return v;
			}
			hv = hashFcn.call( thisArg, v.value );
			if ( contains( hash, hv ) === false ) {
				hash.push( hv );
				break;
			}
		}
		return {
			'value': v.value,
			'done': false
		};
	}

	/**
	* Finishes an iterator.
	*
	* @private
	* @param {*} [value] - value to return
	* @returns {Object} iterator protocol-compliant object
	*/
	function end( value ) {
		FLG = true;
		if ( arguments.length ) {
			return {
				'value': value,
				'done': true
			};
		}
		return {
			'done': true
		};
	}

	/**
	* Returns a new iterator.
	*
	* @private
	* @returns {Iterator} iterator
	*/
	function factory() {
		return iterUniqueByHash( iterator[ iteratorSymbol ](), hashFcn, thisArg ); // eslint-disable-line max-len
	}
}
Returns an iterator which returns unique values according to a hash function.

@param {Iterator} iterator - input iterator
@param {Function} hashFcn - hash function
@param {*} [thisArg] - evaluation context
@throws {TypeError} first argument must be an iterator protocol-compliant object
@throws {TypeError} second argument must be a function
@returns {Iterator} iterator

@example
var array2iterator = require( '@stdlib/array/to-iterator' );

function hashFcn( v ) {
    return v.toString();
}

var iter = iterUniqueByHash( array2iterator( [ 1, 2, 1, 2, 4 ] ), hashFcn );

var v = iter.next().value;
// returns 1

v = iter.next().value;
// returns 2

v = iter.next().value;
// returns 4

var bool = iter.next().done;
// returns true