Files
tasq/node_modules/tldjs/lib/from-host.js
T
2026-04-09 19:01:53 +08:00

17 lines
326 B
JavaScript

'use strict';
/**
* Utility to extract the TLD from a hostname string
*
* @param {string} host
* @return {String}
*/
module.exports = function extractTldFromHost(hostname) {
var lastDotIndex = hostname.lastIndexOf('.');
if (lastDotIndex === -1) {
return null;
}
return hostname.substr(lastDotIndex + 1);
};