client/lib/domains/index.js
function getTld( domainName ) {
	const lastIndexOfDot = domainName.lastIndexOf( '.' );

	if ( lastIndexOfDot === -1 ) {
		return '';
	}

	let tld = parseDomainAgainstTldList( domainName, wpcomMultiLevelTlds );

	if ( ! tld ) {
		tld = domainName.substring( lastIndexOfDot + 1 );
	}

	return tld;
}
function getTld( domainName ) {
	const lastIndexOfDot = domainName.lastIndexOf( '.' );

	if ( lastIndexOfDot === -1 ) {
		return '';
	}

	let tld = parseDomainAgainstTldList( domainName, wpcomMultiLevelTlds );

	if ( ! tld ) {
		tld = domainName.substring( lastIndexOfDot + 1 );
	}

	return tld;
}
Parse the tld from a given domain name, semi-naively. The function
first parses against a list of tlds that have been sold on WP.com
and falls back to a simplistic "everything after the last dot" approach
if the whitelist failed. This is ultimately not comprehensive as that
is a poor base assumption (lots of second level tlds, etc). However,
for our purposes, the approach should be "good enough" for a long time.

@param {string}     domainName     The domain name parse the tld from
@return {string}                   The TLD or an empty string