function substringBefore( str, search ) {
	var idx;
	if ( !isString( str ) ) {
		throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );
	}
	if ( !isString( search ) ) {
		throw new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) );
	}
	idx = str.indexOf( search );
	if ( idx === -1 ) {
		return str;
	}
	return str.substring( 0, idx );
}
Returns the part of a string before a specified substring.

@param {string} str - input string
@param {string} search - search string
@throws {TypeError} first argument must be a string
@throws {TypeError} second argument must be a string
@returns {string} substring

@example
var out = substringBefore( 'beep boop', ' ' );
// returns 'beep'

@example
var out = substringBefore( 'beep boop', 'p' );
// returns 'bee'

@example
var out = substringBefore( 'Hello World!', '' );
// returns ''

@example
var out = substringBefore( 'Hello World!', 'XYZ' );
// returns 'Hello World!'