function truncateMiddle( str, len, seq ) {
	var finalLength;
	var seqLength;
	var strLength;
	var seqStart;
	var seqEnd;

	seqLength = seq.length;
	strLength = str.length;
	if ( len > strLength ) {
		return str;
	}
	finalLength = len - seqLength;
	if ( finalLength < 0 ) {
		return seq.slice( 0, len );
	}

	seqStart = round( finalLength / 2 );
	seqEnd = ( isOdd( finalLength ) ) ? seqStart-1 : seqStart;
	seqEnd = strLength - seqEnd;

	return str.substring( 0, seqStart ) + seq + str.substring( seqEnd );
}
Truncates the middle UTF-16 code units of a string to return a string having a specified length.

@param {string} str - input string
@param {integer} len - output string length (including sequence)
@param {string} seq - custom replacement sequence
@returns {string} truncated string

@example
var str = 'beep boop';
var out = truncateMiddle( str, 5, '...' );
// returns 'b...p'

@example
var str = 'beep boop';
var out = truncateMiddle( str, 5, '>>>' );
// returns 'b>>>p'

@example
var str = 'beep boop';
var out = truncateMiddle( str, 10, '...' );
// returns 'beep boop'

@example
var str = 'beep boop';
var out = truncateMiddle( str, 0, '...' );
// returns ''

@example
var str = 'beep boop';
var out = truncateMiddle( str, 2, '...' );
// returns '..'