function wrap( str ) {
	var len;
	var tmp;
	var s1;
	var s2;
	var i;
	var j;

	len = str.length;
	tmp = str;

	// Check that the signature does not extend beyond 80 characters...
	i = 0; // character index offset
	while ( len > 80 ) {
		// Break the line at the last comma separating parameters before 80 characters...
		for ( j = 79; j >= 0; j-- ) {
			s2 = tmp.slice( ( j > 2 ) ? j-2 : 0, j+1 );
			s1 = s2.slice( 1 );
			if (
				// Note: the following are based on observed patterns. No guarantees of robustness!
				s1 === ', ' ||
				s1 === ',]' ||
				s2 === ', ]' ||
				s2 === ',] '
			) {
				i += j + 1;
				tmp = '  ' + str.slice( i );
				str = str.slice( 0, i ) + '\n' + tmp;
				i += 1; // update offset to include added newline character
				break;
			}
		}
		// Check that a single parameter was not the cause of the overflow (if so, not much we can do unless we were to split on the union type separator `|`, which may be desirable, but, unless this becomes an issue, we don't bother going to the effort)...
		if ( j === -1 ) {
			break;
		}
		// Process the next line:
		len = tmp.length;
	}
	return str;
}
Wraps a signature.

@param {string} str - signature string
@returns {string} wrapped string

@example
// TODO