function isAnagram( str, x ) {
	if ( !isString( str ) ) {
		throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );
	}
	if ( !isString( x ) ) {
		return false;
	}
	str = replace( lowercase( str ), RE_NON_ALPHANUMERIC, '' );
	x = replace( lowercase( x ), RE_NON_ALPHANUMERIC, '' );
	if ( str.length !== x.length ) {
		return false;
	}
	str = str.split( '' ).sort( ascending ).join( '' );
	x = x.split( '' ).sort( ascending ).join( '' );
	return ( str === x );
}
Tests if a value is an anagram.

@param {string} str - comparison string
@param {*} x - value to test
@throws {TypeError} first argument must be a string
@returns {boolean} boolean indicating if a value is an anagram

@example
var bool = isAnagram( 'I am a weakish speller', 'William Shakespeare' );
// returns true

@example
var bool = isAnagram( 'bat', 'tabba' );
// returns false